Skip to content

getGameListWithOptions:completion: ​

Get Game List ​

The getGameListWithOptions method retrieves a paginated game list and returns pagination metadata and the current page of games through a callback.

To retrieve games in a specific selection, use getGameListWithSelectionId:options:completion:. The two methods use different server endpoints; the original method is unchanged.

For category queries, use getGameListWithCategoryOptions:completion: and getCategoryListWithOptions:completion:.


Prerequisite ​

Call initializeWithConfiguration:completion: and wait for the SDK to initialize successfully before calling this method.


Method Declaration ​

objectivec
+ (void)getGameListWithOptions:(nullable SUDOPGameListOptions *)options
                    completion:(nullable void(^)(SUDOPGameListResult *_Nullable result,
                                                 NSError *_Nullable error))completion;

Parameters ​

ParameterTypeRequiredDescription
optionsSUDOPGameListOptions *NoPagination and language options. Pass nil to request page 0 with 10 records per page and the server default language.
completionBlockNoCalled when the request finishes. On success, it returns result; on failure, it returns error. The callback runs on the main thread.

SUDOPGameListOptions ​

FieldTypeDefaultDescription
pageNoNSInteger0Zero-based page number. Values below 0 are treated as 0.
pageSizeNSInteger10Number of records per page. Values less than or equal to 0 are treated as 10.
languageNSString *nilLanguage identifier, such as zh-CN. nil or an empty string uses the server default; the SDK does not substitute the system language.

SUDOPGameListResult Result Model ​

FieldTypeDescription
pageNoNSIntegerThe zero-based page number returned by the server.
pageSizeNSIntegerThe page size returned by the server.
totalNSIntegerTotal number of games.
recordsNSArray<SUDOPGameListItem *> *Games on the current page.

SUDOPGameListItem ​

FieldTypeDescription
gameIdNSString *Game ID.
gameNameNSDictionary<NSString *, NSString *> *Localized game names keyed by language tag.
gameIconNSString *Default game icon URL.
iconNSDictionary<NSString *, NSString *> *Localized icon URLs keyed by language tag, with default for the default icon. May be nil when absent from the response.
versionNSString *Game version.
gameIntroductionNSDictionary<NSString *, NSString *> *Localized game introductions keyed by language tag. May be nil when absent.
categoryInfoSUDOPCategoryListItem *Category metadata including its code, localized name, parent code, and level. May be nil when absent.

Example ​

objectivec
SUDOPGameListOptions *options = [[SUDOPGameListOptions alloc] init];
options.pageNo = 0;
options.pageSize = 20;
options.language = @"zh-CN";

[SUDOP getGameListWithOptions:options
                   completion:^(SUDOPGameListResult * _Nullable result,
                                NSError * _Nullable error) {
    if (error) {
        NSLog(@"Failed to get game list: %@", error.localizedDescription);
        return;
    }

    NSLog(@"Page: %ld, total: %ld", (long)result.pageNo, (long)result.total);
    for (SUDOPGameListItem *item in result.records) {
        NSLog(@"Game ID: %@, version: %@", item.gameId, item.version);
    }
}];

Notes ​

  • Page numbers are zero-based.
  • This method performs a network request. Handle the result asynchronously in completion.
  • When paging, use the returned pageNo, pageSize, and total values to determine whether another page is available.
  • If error is returned, check the network and the games configured in the console.