Friend – Giavapps Game Jolt API

 

About Friends Functions

 

For more info about Friend functions please visit the following link: http://gamejolt.com/game-api/doc/friends

 

Friends Functions

 

gj_friend_fetch_all() Returns the list of a user’s friends. This function returns the id of the HTTP request. For more info: http://gamejolt.com/game-api/doc/friends/fetch/

 

Code Examples

 

Fetching User’s Friends

 

Create Event

 

gj_init("game_id","private_key");//Initializes Giavapps Game Jolt API
request_user_auth = gj_user_auth("username","user_token");//Authenticates the user
request_friend_fetch_all = –1;//Request for fetching user’s friends

 

Game End Event

 

gj_deinit();//Deinitializes Giavapps Game Jolt API

 

Async – HTTP Event

 

if(gj_http_status() != 0){exit;}//Checks if the status is complete

gj_http_result();//Retrieves result data for gj_result_* functions

if(gj_http_id() == request_user_auth)//Checks if the id is equal to the http request id
{

if(gj_result_success())
{

show_debug_message("THE USER’S CREDENTIALS ARE VALID!");
request_friend_fetch_all = gj_friend_fetch_all();//Fetches user’s friends

}
else
{

show_debug_message("THE USER’S CREDENTIALS ARE INVALID!");

}

}
else if(gj_http_id() == request_friend_fetch_all)//Checks if the id is equal to the http request id
{

if(gj_result_success())
{

show_debug_message("FRIENDS HAVE BEEN FETCHED!");

for(var r=0; r<gj_result_count(); r++)//Processes all results
{

show_debug_message("RESULT ID "+string(r)+":");

for(var f=0; f<gj_result_field_count(); f++)//Processes all fields
{

show_debug_message(gj_result_field_name(f)+"="+gj_result_field_value(r, gj_result_field_name(f)));

}

}

}
else
{

show_debug_message("FRIENDS HAVE NOT BEEN FETCHED!");

}

}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Comments are closed.