Skip to content

rc_client_begin_fetch_leaderboard_entries

Jamiras edited this page Jun 30, 2023 · 5 revisions

Fetches a list of leaderboard entries from the server.

Syntax

rc_client_async_handle_t* rc_client_begin_fetch_leaderboard_entries(
    rc_client_t* client,
    uint32_t leaderboard_id,
    uint32_t first_entry, 
    uint32_t count,
    rc_client_fetch_leaderboard_entries_callback_t callback,
    void* callback_userdata
);

Parameters

client

The rc_client_t to use to fetch the leaderboard entries.

leaderboard_id

The unique identifier of the leaderboard to query.

first_entry

The index of the first entry to retrieve (1-based).

count

The number of entries to retrieve.

callback

Function to call when the list is available.

callback_userdata

Additional information to pass to the callback function.

Returns

Pointer to an rc_client_async_handle_t that can be passed to rc_client_abort_async to cancel the leaderboard query request. The rc_client_async_handle_t is invalid after callback has been called.


rc_client_fetch_leaderboard_entries_callback_t

void (*rc_client_fetch_leaderboard_entries_callback_t)(
    int result,
    const char* error_message,
    rc_client_leaderboard_entry_list_t* list,
    rc_client_t* client,
    void* userdata
);

result

RC_OK on success, or an error code indicating the failure.

result problem
RC_OK Leaderboard entries were successfully retrieved.
RC_INVALID_STATE Generic failure. See error_message for details.
RC_INVALID_JSON Server response could not be processed.
RC_MISSING_VALUE Server response was not complete.
RC_API_FAILURE Error occurred on the server. See error_message for details.
RC_OUT_OF_MEMORY Memory could not be allocated to hold the response.

error_message

NULL on success, or a message related to a non-successful result.

list

Pointer to a rc_client_leaderboard_entry_list_t object containing the requested entries for the leaderboard.

It must be released by calling rc_client_destroy_leaderboard_entry_list.

Will be NULL if an error occurred.

client

The rc_client_t that was handling the load game attempt.

userdata

A client provided pointer passed to the begin function as callback_userdata.


rc_client_leaderboard_entry_list_t

typedef struct rc_client_leaderboard_entry_list_t {
  rc_client_leaderboard_entry_t* entries;
  uint32_t num_entries;
  int32_t user_index;
} rc_client_achievement_list_t;

entries

An array of leaderboard entries.

num_entries

The number of entries in the entries array.

user_index

The index within entries for the logged in user. -1 if there if the logged in user doesn't appear in the list, or there is no logged in user.


rc_client_leaderboard_entry_t

typedef struct rc_client_leaderboard_entry_t {
  const char* user;
  char display[24];
  time_t submitted;
  uint32_t rank;
  uint32_t index;
} rc_client_leaderboard_entry_t;

user

The display name of the user associated to the entry.

display

The formatted value.

submitted

When the entry was submitted.

rank

The rank of the entry (may be shared if multiple entries have the same value).

index

The index of the value (will not be shared if multiple entries have the same value).

Remarks

The rc_client_leaderboard_list_t instance created by this function must be released by calling rc_client_destroy_leaderboard_entry_list.

Minimum version: 11.0.0

See also

rc_client_begin_fetch_leaderboard_entries_around_user

rc_client_destroy_leaderboard_entry_list

rc_client_leaderboard_entry_get_user_image_url

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