Skip to content

getGameListByCategory ​

Get games by category ​

POST /v1/game/getListByCategory

Call initSDK successfully, then complete user authentication before requesting data. The SDK handles authentication headers, signing and encryption. These endpoints require server support.

Method declaration ​

java
public static void getGameListByCategory(String primaryCategoryId, String secondaryCategoryId,
        SUDOPGameListParams params, SUDOPGameListCallback callback);

Parameters ​

params may be null. Defaults are page 0, page size 10 and the server default language.

Category IDs are separate method arguments; pagination and language belong to SUDOPGameListParams.

Parameter / fieldTypeDescription
primaryCategoryIdStringPrimary category code; optional.
secondaryCategoryIdStringSecondary category code; requires the primary category code.
pageNointZero-based; negative values become 0.
pageSizeintDefaults to 10; values <= 0 become 10.
languageStringOptional BCP 47 tag, such as en-US. null or an empty string uses the server default; the SDK does not substitute the system language.

Use code from getCategories. 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 ​

java
public interface SUDOPGameListCallback {
    void onSuccess(SUDOPGameListResult result);
    void onFailure(int retCode, String retMsg);
}

Callbacks run on the main thread. If callback is null, the method returns without sending a request.

Reuses SUDOPGameListResult and SUDOPGameListItem; see getGameList 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.

java
SUDOPGameListParams params = new SUDOPGameListParams();
params.pageNo = 0;
params.pageSize = 20;
params.language = "en-US";

SUDOP.getGameListByCategory("123", null, params, new SUDOPGameListCallback() {
    @Override
    public void onSuccess(SUDOPGameListResult result) {
        Log.i("SUDOP", "page=" + result.pageNo + ", total=" + result.total);
    }

    @Override
    public void onFailure(int retCode, String retMsg) {
        Log.e("SUDOP", "Request failed: " + retCode + ", " + retMsg);
    }
});

Use the returned pageNo, pageSize and total to determine whether another page is available.