getRankingsListWithOptions:completion:
Get Game Rankings
Retrieves the available game rankings, including localized names, titles, and descriptions. Initialize the SDK before calling this method. It requests /v1/game/getRankingsList.
Method Declaration
objectivec
+ (void)getRankingsListWithOptions:(nullable SUDOPRankingsListOptions *)options
completion:(nullable void(^)(SUDOPRankingsListResult *_Nullable result,
NSError *_Nullable error))completion;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| options | SUDOPRankingsListOptions * | No | Ranking query options. A nil or empty language uses the server default. |
| completion | Block | No | Returns the rankings on success or an NSError on failure. |
Result Models
SUDOPRankingsListResult.records is an array of SUDOPRankingsListItem objects:
| Field | Type | Description |
|---|---|---|
| rankId | NSString * | Ranking ID, preserved as a string. |
| name | NSDictionary<NSString *, NSString *> * | Localized ranking names. |
| title | NSDictionary<NSString *, NSString *> * | Localized ranking titles. |
| rankingDescription | NSDictionary<NSString *, NSString *> * | Localized descriptions, mapped from the server's description field. |
Example
objectivec
SUDOPRankingsListOptions *options = [[SUDOPRankingsListOptions alloc] init];
options.language = @"en-US";
[SUDOP getRankingsListWithOptions:options
completion:^(SUDOPRankingsListResult * _Nullable result,
NSError * _Nullable error) {
if (error) {
NSLog(@"Failed to get rankings: %@", error.localizedDescription);
return;
}
for (SUDOPRankingsListItem *item in result.records) {
NSLog(@"Ranking ID: %@, name: %@", item.rankId, item.name);
}
}];Notes
- Keep
rankIdas a string; do not convert it through floating-point or narrow integer types. - Pass a ranking ID to
getGameListByRankIdWithOptions:completion:to retrieve its games.
