Skip to content

rc_api_process_fetch_leaderboard_info_response

Jamiras edited this page Aug 27, 2021 · 5 revisions

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

Syntax

int rc_api_process_fetch_leaderboard_info_response(
    rc_api_fetch_leaderboard_info_response_t* response,
    const char* server_response
);

Parameters

response

The rc_api_fetch_leaderboard_info_response_t to construct.

server_response

The body of the HTTP response received from the server.


struct rc_api_fetch_leaderboard_info_response_t
{
  unsigned id;
  int format;
  int lower_is_better;
  const char* title;
  const char* description;
  const char* definition;
  unsigned game_id;
  const char* author;
  time_t created;
  time_t updated;

  rc_api_lboard_info_t* entries;
  unsigned num_entries;

  rc_api_response_t response;
};

id

The unique identifier of the leaderboard.

format

The format value to pass to rc_runtime_format_lboard_value.

lower_is_better

Indicates whether low scores are considered better than high scores.

title

The title of the leaderboard.

description

A description of what needs to be done to get on the leaderboard.

game_id

The unique identifier of the game the leaderboard is associated to.

author

The user who originally created the leaderboard.

created

When the leaderboard was first created.

updated

When the leaderboard was last updated.

entries

An array of rc_api_lboard_info_entry_t entries matching the request parameters.

num_entries

The number of items in the entries array.

response

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


struct rc_api_lboard_info_entry_t
{
  const char* username;
  unsigned rank;
  unsigned index;
  int score;
  time_t submitted;
}

username

The name of the user associated to the entry.

rank

The rank of the entry (may be shared if multiple users have the same score).

index

The index of the entry.

score

The value to be passed to rc_runtime_format_lboard_value.

submitted

When the entry was submitted.

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_leaderboard_info_response_t must be destroyed by rc_api_destroy_fetch_leaderboard_info_response when the caller is done with it.

Minimum version: 10.2.0

See also

rc_api_init_fetch_leaderboard_info_request

rc_api_destroy_fetch_leaderboard_info_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