getSelectionListWithOptions:completion:
获取选品单列表
分页获取选品单及其多语言名称。拿到 selectionId 后,可通过 getGameListWithSelectionId:options:completion: 查询该选品单中的游戏。
调用前须完成 initializeWithConfiguration:completion: 初始化,无需用户登录。
方法声明
objectivec
+ (void)getSelectionListWithOptions:(nullable SUDOPSelectionListOptions *)options
completion:(nullable void(^)(SUDOPSelectionListResult *_Nullable result,
NSError *_Nullable error))completion;参数说明
| 参数 | 类型 | 必传 | 描述 |
|---|---|---|---|
| options | SUDOPSelectionListOptions * | 否 | 分页及语言参数。传入 nil 时使用第 0 页、每页 10 条及服务端默认语言。 |
| completion | Block | 否 | 成功返回 result,失败返回 error。 |
SUDOPSelectionListOptions
| 字段 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| pageNo | NSInteger | 0 | 页码,从 0 开始,小于 0 时按 0 处理。 |
| pageSize | NSInteger | 10 | 每页条数,小于或等于 0 时按 10 处理。 |
| language | NSString * | nil | 可选的 BCP 47 语言标签,如 zh-CN;nil 或空字符串使用服务端默认值。 |
返回模型 SUDOPSelectionListResult
| 字段 | 类型 | 描述 |
|---|---|---|
| pageNo | NSInteger | 当前页码,从 0 开始。 |
| pageSize | NSInteger | 每页条数。 |
| total | NSInteger | 选品单总数。 |
| records | NSArray<SUDOPSelectionListItem *> * | 当前页的选品单列表。 |
SUDOPSelectionListItem
| 字段 | 类型 | 描述 |
|---|---|---|
| selectionId | NSString * | 选品单 ID。 |
| name | NSDictionary<NSString *, NSString *> * | 选品单多语言名称,key 为语言标签,default 为默认名称。 |
代码示例
objectivec
SUDOPSelectionListOptions *options = [[SUDOPSelectionListOptions alloc] init];
options.language = @"zh-CN";
[SUDOP getSelectionListWithOptions:options
completion:^(SUDOPSelectionListResult * _Nullable result,
NSError * _Nullable error) {
if (error) {
NSLog(@"获取选品单失败: %@", error.localizedDescription);
return;
}
for (SUDOPSelectionListItem *item in result.records) {
NSLog(@"选品单 ID: %@,名称: %@", item.selectionId, item.name);
}
}];