Path: blob/master/dep/rcheevos/include/rc_api_info.h
4246 views
#ifndef RC_API_INFO_H1#define RC_API_INFO_H23#include "rc_api_request.h"45#include <stdint.h>6#include <time.h>78RC_BEGIN_C_DECLS910/* --- Fetch Achievement Info --- */1112/**13* API parameters for a fetch achievement info request.14*/15typedef struct rc_api_fetch_achievement_info_request_t {16/* The username of the player */17const char* username;18/* The API token from the login request */19const char* api_token;20/* The unique identifier of the achievement */21uint32_t achievement_id;22/* The 1-based index of the first entry to retrieve */23uint32_t first_entry;24/* The number of entries to retrieve */25uint32_t count;26/* Non-zero to only return unlocks earned by the user's friends */27uint32_t friends_only;28}29rc_api_fetch_achievement_info_request_t;3031/* An achievement awarded entry */32typedef struct rc_api_achievement_awarded_entry_t {33/* The user associated to the entry */34const char* username;35/* A URL to the user's avatar image */36const char* avatar_url;37/* When the achievement was awarded */38time_t awarded;39}40rc_api_achievement_awarded_entry_t;4142/**43* Response data for a fetch achievement info request.44*/45typedef struct rc_api_fetch_achievement_info_response_t {46/* The unique identifier of the achievement */47uint32_t id;48/* The unique identifier of the game to which the leaderboard is associated */49uint32_t game_id;50/* The number of times the achievement has been awarded */51uint32_t num_awarded;52/* The number of players that have earned at least one achievement for the game */53uint32_t num_players;5455/* An array of recently rewarded entries */56rc_api_achievement_awarded_entry_t* recently_awarded;57/* The number of items in the recently_awarded array */58uint32_t num_recently_awarded;5960/* Common server-provided response information */61rc_api_response_t response;62}63rc_api_fetch_achievement_info_response_t;6465RC_EXPORT int RC_CCONV rc_api_init_fetch_achievement_info_request(rc_api_request_t* request, const rc_api_fetch_achievement_info_request_t* api_params);66RC_EXPORT int RC_CCONV rc_api_init_fetch_achievement_info_request_hosted(rc_api_request_t* request, const rc_api_fetch_achievement_info_request_t* api_params, const rc_api_host_t* host);67/* [deprecated] use rc_api_process_fetch_achievement_info_server_response instead */68RC_EXPORT int RC_CCONV rc_api_process_fetch_achievement_info_response(rc_api_fetch_achievement_info_response_t* response, const char* server_response);69RC_EXPORT int RC_CCONV rc_api_process_fetch_achievement_info_server_response(rc_api_fetch_achievement_info_response_t* response, const rc_api_server_response_t* server_response);70RC_EXPORT void RC_CCONV rc_api_destroy_fetch_achievement_info_response(rc_api_fetch_achievement_info_response_t* response);7172/* --- Fetch Leaderboard Info --- */7374/**75* API parameters for a fetch leaderboard info request.76*/77typedef struct rc_api_fetch_leaderboard_info_request_t {78/* The unique identifier of the leaderboard */79uint32_t leaderboard_id;80/* The number of entries to retrieve */81uint32_t count;82/* The 1-based index of the first entry to retrieve */83uint32_t first_entry;84/* The username of the player around whom the entries should be returned */85const char* username;86}87rc_api_fetch_leaderboard_info_request_t;8889/* A leaderboard info entry */90typedef struct rc_api_lboard_info_entry_t {91/* The user associated to the entry */92const char* username;93/* A URL to the user's avatar image */94const char* avatar_url;95/* The rank of the entry */96uint32_t rank;97/* The index of the entry */98uint32_t index;99/* The value of the entry */100int32_t score;101/* When the entry was submitted */102time_t submitted;103}104rc_api_lboard_info_entry_t;105106/**107* Response data for a fetch leaderboard info request.108*/109typedef struct rc_api_fetch_leaderboard_info_response_t {110/* The unique identifier of the leaderboard */111uint32_t id;112/* The format to pass to rc_format_value to format the leaderboard value */113int format;114/* If non-zero, indicates that lower scores appear first */115uint32_t lower_is_better;116/* The title of the leaderboard */117const char* title;118/* The description of the leaderboard */119const char* description;120/* The definition of the leaderboard to be passed to rc_runtime_activate_lboard */121const char* definition;122/* The unique identifier of the game to which the leaderboard is associated */123uint32_t game_id;124/* The author of the leaderboard */125const char* author;126/* When the leaderboard was first uploaded to the server */127time_t created;128/* When the leaderboard was last modified on the server */129time_t updated;130131/* An array of requested entries */132rc_api_lboard_info_entry_t* entries;133/* The number of items in the entries array */134uint32_t num_entries;135136/* The total number of entries on the server */137uint32_t total_entries;138139/* Common server-provided response information */140rc_api_response_t response;141}142rc_api_fetch_leaderboard_info_response_t;143144RC_EXPORT int RC_CCONV rc_api_init_fetch_leaderboard_info_request(rc_api_request_t* request, const rc_api_fetch_leaderboard_info_request_t* api_params);145RC_EXPORT int RC_CCONV rc_api_init_fetch_leaderboard_info_request_hosted(rc_api_request_t* request, const rc_api_fetch_leaderboard_info_request_t* api_params, const rc_api_host_t* host);146/* [deprecated] use rc_api_process_fetch_leaderboard_info_server_response instead */147RC_EXPORT int RC_CCONV rc_api_process_fetch_leaderboard_info_response(rc_api_fetch_leaderboard_info_response_t* response, const char* server_response);148RC_EXPORT int RC_CCONV rc_api_process_fetch_leaderboard_info_server_response(rc_api_fetch_leaderboard_info_response_t* response, const rc_api_server_response_t* server_response);149RC_EXPORT void RC_CCONV rc_api_destroy_fetch_leaderboard_info_response(rc_api_fetch_leaderboard_info_response_t* response);150151/* --- Fetch Games List --- */152153/**154* API parameters for a fetch games list request.155*/156typedef struct rc_api_fetch_games_list_request_t {157/* The unique identifier of the console to query */158uint32_t console_id;159}160rc_api_fetch_games_list_request_t;161162/* A game list entry */163typedef struct rc_api_game_list_entry_t {164/* The unique identifier of the game */165uint32_t id;166/* The name of the game */167const char* name;168}169rc_api_game_list_entry_t;170171/**172* Response data for a fetch games list request.173*/174typedef struct rc_api_fetch_games_list_response_t {175/* An array of requested entries */176rc_api_game_list_entry_t* entries;177/* The number of items in the entries array */178uint32_t num_entries;179180/* Common server-provided response information */181rc_api_response_t response;182}183rc_api_fetch_games_list_response_t;184185RC_EXPORT int RC_CCONV rc_api_init_fetch_games_list_request(rc_api_request_t* request, const rc_api_fetch_games_list_request_t* api_params);186RC_EXPORT int RC_CCONV rc_api_init_fetch_games_list_request_hosted(rc_api_request_t* request, const rc_api_fetch_games_list_request_t* api_params, const rc_api_host_t* host);187/* [deprecated] use rc_api_process_fetch_games_list_server_response instead */188RC_EXPORT int RC_CCONV rc_api_process_fetch_games_list_response(rc_api_fetch_games_list_response_t* response, const char* server_response);189RC_EXPORT int RC_CCONV rc_api_process_fetch_games_list_server_response(rc_api_fetch_games_list_response_t* response, const rc_api_server_response_t* server_response);190RC_EXPORT void RC_CCONV rc_api_destroy_fetch_games_list_response(rc_api_fetch_games_list_response_t* response);191192/* --- Fetch Game Titles --- */193194/**195* API parameters for a fetch games list request.196*/197typedef struct rc_api_fetch_game_titles_request_t {198/* An array of game ids to fetch titles for */199const uint32_t* game_ids;200/* The number of items in the game_ids array */201uint32_t num_game_ids;202}203rc_api_fetch_game_titles_request_t;204205/* A game title entry */206typedef struct rc_api_game_title_entry_t {207/* The unique identifier of the game */208uint32_t id;209/* The title of the game */210const char* title;211/* The image name for the game badge */212const char* image_name;213}214rc_api_game_title_entry_t;215216/**217* Response data for a fetch games title request.218*/219typedef struct rc_api_fetch_game_titles_response_t {220/* An array of requested entries */221rc_api_game_title_entry_t* entries;222/* The number of items in the entries array */223uint32_t num_entries;224225/* Common server-provided response information */226rc_api_response_t response;227}228rc_api_fetch_game_titles_response_t;229230RC_EXPORT int RC_CCONV rc_api_init_fetch_game_titles_request(rc_api_request_t* request, const rc_api_fetch_game_titles_request_t* api_params);231RC_EXPORT int RC_CCONV rc_api_init_fetch_game_titles_request_hosted(rc_api_request_t* request, const rc_api_fetch_game_titles_request_t* api_params, const rc_api_host_t* host);232RC_EXPORT int RC_CCONV rc_api_process_fetch_game_titles_server_response(rc_api_fetch_game_titles_response_t* response, const rc_api_server_response_t* server_response);233RC_EXPORT void RC_CCONV rc_api_destroy_fetch_game_titles_response(rc_api_fetch_game_titles_response_t* response);234235/* --- Fetch Game Hashes --- */236237/**238* API parameters for a fetch games list request.239*/240typedef struct rc_api_fetch_hash_library_request_t {241/**242* The unique identifier of the console to query.243* Passing RC_CONSOLE_UNKNOWN will return hashes for all consoles.244*/245uint32_t console_id;246} rc_api_fetch_hash_library_request_t;247248/* A hash library entry */249typedef struct rc_api_hash_library_entry_t {250/* The hash for the game */251const char* hash;252/* The unique identifier of the game */253uint32_t game_id;254} rc_api_hash_library_entry_t;255256/**257* Response data for a fetch hash library request.258*/259typedef struct rc_api_fetch_hash_library_response_t {260/* An array of entries, one per game */261rc_api_hash_library_entry_t* entries;262/* The number of items in the entries array */263uint32_t num_entries;264265/* Common server-provided response information */266rc_api_response_t response;267}268rc_api_fetch_hash_library_response_t;269270RC_EXPORT int RC_CCONV rc_api_init_fetch_hash_library_request(rc_api_request_t* request, const rc_api_fetch_hash_library_request_t* api_params);271RC_EXPORT int RC_CCONV rc_api_init_fetch_hash_library_request_hosted(rc_api_request_t* request, const rc_api_fetch_hash_library_request_t* api_params, const rc_api_host_t* host);272RC_EXPORT int RC_CCONV rc_api_process_fetch_hash_library_server_response(rc_api_fetch_hash_library_response_t* response, const rc_api_server_response_t* server_response);273RC_EXPORT void RC_CCONV rc_api_destroy_fetch_hash_library_response(rc_api_fetch_hash_library_response_t* response);274275RC_END_C_DECLS276277#endif /* RC_API_INFO_H */278279280