Skip to content

searchGamesWithOptions:completion: ​

Search Games ​

Searches for games by keyword and returns cursor-paginated results. Initialize the SDK before calling this method. It requests /v1/game/search.


Method Declaration ​

objectivec
+ (void)searchGamesWithOptions:(nullable SUDOPGameSearchOptions *)options
                    completion:(nullable void(^)(SUDOPGameSearchResult *_Nullable result,
                                                  NSError *_Nullable error))completion;

SUDOPGameSearchOptions ​

FieldTypeDefaultDescription
keywordNSString *nilRequired. A non-empty search term; leading and trailing whitespace is removed.
languageNSString *nilLanguage identifier such as en-US. nil or empty uses the server default.
cursorNSString *nilCursor returned by the previous page. Use nil for the first request.
pageSizeNSInteger10Records per page. Values less than or equal to 0 are treated as 10.

Result Models ​

FieldTypeDescription
listNSArray<SUDOPGameSearchItem *> *Games in the current page. Each item includes gameId, localized gameName, and localized icon.
paginationSUDOPGameSearchPagination *Pagination data containing total, hasMore, and nullable nextCursor.

Example ​

objectivec
SUDOPGameSearchOptions *options = [[SUDOPGameSearchOptions alloc] init];
options.keyword = @"party";
options.language = @"en-US";
options.pageSize = 20;

[SUDOP searchGamesWithOptions:options
                   completion:^(SUDOPGameSearchResult * _Nullable result,
                                NSError * _Nullable error) {
    if (error) {
        NSLog(@"Failed to search games: %@", error.localizedDescription);
        return;
    }
    NSLog(@"Returned: %ld, has more: %@",
          (long)result.list.count,
          result.pagination.hasMore ? @"YES" : @"NO");
}];

Notes ​

  • A nil options object or a missing, empty, or whitespace-only keyword returns a parameter error.
  • To load another page, pass the previous page's nextCursor unchanged as the next request's cursor.
  • The callback runs on the main thread.