getCategoryListWithOptions:completion:
Get categories
POST /v1/game/getCategories
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)getCategoryListWithOptions:(nullable SUDOPCategoryListOptions *)options
completion:(nullable void(^)(SUDOPCategoryListResult *_Nullable result, NSError *_Nullable error))completion;Parameters
options may be nil. Defaults are page 0, page size 10 and the server default language.
| Parameter / field | Type | Description |
|---|---|---|
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. |
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.
SUDOPCategoryListResult
| Field | Type | Description |
|---|---|---|
pageNo | NSInteger | Current zero-based page. |
pageSize | NSInteger | Page size. |
total | NSInteger | Total number of categories. |
records | NSArray<SUDOPCategoryListItem *> * | Categories on this page. |
SUDOPCategoryListItem
| Field | Type | Description |
|---|---|---|
code | NSString * | Category code. |
name | NSDictionary<NSString *, NSString *> * | Localized names keyed by language tag; default is the fallback. |
parentCode | NSString * | Parent category code; maps to parent_code in the response. |
level | NSInteger | 1: primary category; 2: secondary category. |
name remains a multilingual map when language is set. Use a non-empty value for the requested language, then fall back to default. Pass the category codes to getGameListWithCategoryOptions.
Example
Run after initialization and authentication succeed. Replace example category codes with actual values.
SUDOPCategoryListOptions *options = [[SUDOPCategoryListOptions alloc] init];
options.pageNo = 0;
options.pageSize = 20;
options.language = @"en-US";
[SUDOP getCategoryListWithOptions:options completion:^(SUDOPCategoryListResult * _Nullable result, NSError * _Nullable error) {
if (error) {
NSLog(@"Request failed: %@", error.localizedDescription);
return;
}
NSLog(@"page=%ld, total=%ld", (long)result.pageNo, (long)result.total);
for (SUDOPCategoryListItem *item in result.records) {
NSLog(@"code=%@, parentCode=%@, level=%ld", item.code, item.parentCode, (long)item.level);
}
}];Use the returned pageNo, pageSize and total to determine whether another page is available.
