getGameListWithCategoryOptions:completion:
Get games by category
POST /v1/game/getListByCategory
Call initializeWithConfiguration successfully, then complete user authentication before requesting data. The SDK handles authentication headers, signing and encryption. These endpoints require server support.
Method declaration
+ (void)getGameListWithCategoryOptions:(nullable SUDOPGameListByCategoryOptions *)options
completion:(nullable void(^)(SUDOPGameListResult *_Nullable result, NSError *_Nullable error))completion;Parameters
options may be nil. Defaults are page 0, page size 10 and the server default language.
Category IDs are fields of SUDOPGameListByCategoryOptions, which extends SUDOPGameListOptions.
| Parameter / field | Type | Description |
|---|---|---|
primaryCategoryId | NSString * | Primary category code; optional. |
secondaryCategoryId | NSString * | Secondary category code; requires the primary category code. |
pageNo | NSInteger | Zero-based; negative values become 0. |
pageSize | NSInteger | Defaults to 10; values <= 0 become 10. |
language | NSString * | Optional BCP 47 tag, such as en-US. nil or an empty string uses the server default; the SDK does not substitute the system language. |
Use code from getCategoryListWithOptions. For a secondary category, use its parentCode as primaryCategoryId and its code as secondaryCategoryId. Keep codes as strings. Both IDs may be omitted. Providing a secondary ID without a primary ID reports a parameter error without sending a request.
Callback and result
Success returns result; failure returns error. completion may be nil. Call from the main thread; local validation failures can invoke the callback before the method returns.
Reuses SUDOPGameListResult and SUDOPGameListItem; see getGameListWithOptions for pageNo, pageSize, total, records, and the game fields gameId, gameName, gameIcon, icon, version.
Example
Run after initialization and authentication succeed. Replace example category codes with actual values.
SUDOPGameListByCategoryOptions *options = [[SUDOPGameListByCategoryOptions alloc] init];
options.pageNo = 0;
options.pageSize = 20;
options.language = @"en-US";
options.primaryCategoryId = @"123";
options.secondaryCategoryId = nil;
[SUDOP getGameListWithCategoryOptions:options completion:^(SUDOPGameListResult * _Nullable result, NSError * _Nullable error) {
if (error) {
NSLog(@"Request failed: %@", error.localizedDescription);
return;
}
NSLog(@"page=%ld, total=%ld", (long)result.pageNo, (long)result.total);
}];Use the returned pageNo, pageSize and total to determine whether another page is available.
