Skip to content

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 ​

objectivec
+ (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 / fieldTypeDescription
pageNoNSIntegerZero-based; negative values become 0.
pageSizeNSIntegerDefaults to 10; values <= 0 become 10.
languageNSString *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 ​

FieldTypeDescription
pageNoNSIntegerCurrent zero-based page.
pageSizeNSIntegerPage size.
totalNSIntegerTotal number of categories.
recordsNSArray<SUDOPCategoryListItem *> *Categories on this page.

SUDOPCategoryListItem ​

FieldTypeDescription
codeNSString *Category code.
nameNSDictionary<NSString *, NSString *> *Localized names keyed by language tag; default is the fallback.
parentCodeNSString *Parent category code; maps to parent_code in the response.
levelNSInteger1: 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.

objectivec
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.