Skip to content

rc_api_process_fetch_game_data_response

Jamiras edited this page Mar 1, 2024 · 6 revisions

Parses the response for fetching the achievement information for a game.

Syntax

// 11.0+
int rc_api_process_fetch_game_data_server_response(
    rc_api_fetch_game_data_response_t* response,
    const rc_api_server_response_t* server_response
);

// [deprecated]
int rc_api_process_fetch_game_data_response(
    rc_api_fetch_game_data_response_t* response,
    const char* server_response
);

Parameters

response

The rc_api_fetch_game_data_response_t to construct.

server_response

The body of the HTTP response received from the server.


struct rc_api_fetch_game_data_response_t
{
  unsigned id;
  unsigned console_id;
  const char* title;
  const char* image_name;
  const char* rich_presence_script;

  rc_api_achievement_definition_t* achievements;
  unsigned num_achievements;

  rc_api_leaderboard_definition_t* leaderboards;
  unsigned num_leaderboards;

  rc_api_response_t response;
};

id

The unique identifier of the game.

console_id

The console associated to the game.

title

The title of the game.

image_name

The image name to pass to rc_api_init_fetch_image_request for the game.

rich_presence_script

The rich presence script for the game.

achievements

An array of rc_api_achievement_definition_t associated to the game.

num_achievements

The number of items in the achievements array.

leaderboards

An array of rc_api_leaderboard_definition_t associated to the game.

num_leaderboards

The number of items in the leaderboards array.

response

Common server-provided response information. Contains a succeeded flag, and an error_message field.


struct rc_api_achievement_definition_t
{
  unsigned id;
  unsigned points;
  unsigned category;
  const char* title;
  const char* description;
  const char* definition;
  const char* author;
  const char* badge_name;
  time_t created;
  time_t updated;
}

id

The unique identifier of the achievement.

points

How many points the achievement is worth.

category

RC_ACHIEVEMENT_CATEGORY_CORE for Core achievements, RC_ACHIEVEMENT_CATEGORY_UNOFFICIAL for unofficial achievements.

title

The title of the achievement.

description

The description of the achievement.

definition

The definition of the achievement to be passed to rc_runtime_activate_achievement.

author

The original author of the achievement.

badge_name

The image name to pass to rc_api_init_fetch_image_request for the achievement.

created

When the achievement was first created.

updated

When the achievement was last updated.


struct rc_api_leaderboard_definition_t
{
  unsigned id;
  int format;
  const char* title;
  const char* description;
  const char* definition;
  int lower_is_better;
  int hidden;
}

id

The unique identifier of the leaderboard.

format

The format to pass to rc_runtime_format_lboard_value to display values from the leaderboard.

title

The title of the leaderboard.

description

The description of the leaderboard.

definition

The definition of the leaderboardto be passed to rc_runtime_activate_lboard.

lower_is_better (Minimum version: 10.3.0)

If non-zero, lower scores are ranked higher for this leaderboard.

hidden (Minimum version: 10.3.0)

If non-zero, this leaderboard should not be browsable in the client.

Return value

If the function succeeds, the return value is RC_OK. Otherwise, the error code can be converted to a string using rc_error_str.

  • RC_INVALID_JSON - the response was not valid JSON.
  • RC_MISSING_VALUE - one or more required fields was not found in the response.

Remarks

The rc_api_fetch_game_data_response_t must be destroyed by rc_api_destroy_fetch_game_data_response when the caller is done with it.

Minimum version: 10.0.0

See also

rc_api_init_fetch_game_data_request

rc_api_destroy_fetch_game_data_response

rcheevos

rc_client

Integration guide

client

user

game

processing

rc_client_raintegration

Integration guide

rc_runtime

rhash

rapi

common

user

runtime

info

Clone this wiki locally