Skip to main content

Catalog Module

The Catalog Module provides functionality to retrieve information about casino games, game categories, and game providers. This module is part of the Gamanza Engage Web Client SDK and is automatically instantiated when the SDK is initialized.

Accessing the Module

The CatalogModule is initialized internally by the SDK and should not be instantiated directly. It's accessible through the main SDK instance.

// Example of accessing the CrmModule through the SDK
const { Catalog } = GamanzaEngageWebClientSDK.getInstance();

Public Methods

getCasinoGameCategories

Retrieves the list of casino game categories.

getCasinoGameCategories(): Promise<GameCategory[]>

Description:
This method fetches a list of all available casino game categories. It uses a caching mechanism to optimize performance - first checking if data is available in the cache before making an API call. If the API call fails, it attempts to return stale data from the cache.

Parameters:
None

Returns:
A Promise that resolves to an array of GameCategory objects with the following properties:

PropertyTypeDescription
categoryIdstringUnique identifier for the category
categoryNamestringDisplay name of the category
_idstringInternal identifier

Example:

// Get all game categories
const categories = await sdk.Catalog.getCasinoGameCategories();
console.log(categories);
// [
// { categoryId: "slots", categoryName: "Slots", _id: "123" },
// { categoryId: "table-games", categoryName: "Table Games", _id: "456" },
// ...
// ]

getCasinoGames

Fetches a list of casino games based on the provided filter criteria.

getCasinoGames(request: GameFilterRequest): Promise<PaginationResponse<GameType[]>>

Description:
This method retrieves a paginated list of casino games that match the specified filter criteria. It uses caching to optimize performance and reduce redundant API calls.

Parameters:
request - An object of type GameFilterRequest with the following properties:

PropertyTypeRequiredDescription
pagenumberYesPage number to retrieve (starting from 1)
limitnumberYesNumber of items per page
order'asc' | 'desc'NoSort order
idOrNamestringNoFilter by game ID or name
gameNamestringNoFilter by exact game name
gameIdstringNoFilter by exact game ID
gameProviderstringNoFilter by game provider
gameCategorystringNoFilter by game category

Returns:
A Promise that resolves to a PaginationResponse<GameType[]> object with the following structure:

PropertyTypeDescription
docsGameType[]Array of game objects matching the filter criteria
hasNextPagebooleanWhether there is a next page of results
hasPrevPagebooleanWhether there is a previous page of results
limitnumberNumber of items per page
nextPagenumberNext page number
pagenumberCurrent page number
pagingCounternumberThe starting index of first document
prevPagenumber | nullPrevious page number or null if on first page
totalDocsnumberTotal number of documents matching the criteria
totalPagesnumberTotal number of pages

Each GameType object in the docs array has the following properties:

PropertyTypeDescription
_idstringInternal identifier
gameIdstringUnique identifier for the game
namestringDisplay name of the game
providerIdobjectInformation about the game provider
providerId.providerIdstringUnique identifier for the provider
providerId.namestringName of the provider
categoryIdobjectInformation about the game category
categoryId.categoryIdstringUnique identifier for the category
categoryId.namestringName of the category
devicestring[]Array of supported device types
gameThumbnailstringURL to the game thumbnail image
widgetThumbnailstringURL to the widget thumbnail image
gameLaunchstringURL to launch the game
gameLaunchI18nobjectInternationalized game launch URLs
bonusBuyAllowbooleanWhether bonus buy is allowed for this game

Example:

// Get first page of games with 10 items per page
const gamesResponse = await sdk.Catalog.getCasinoGames({
page: 1,
limit: 10,
gameCategory: "slots"
});

console.log(gamesResponse.totalDocs); // Total number of games
console.log(gamesResponse.docs); // Array of games on this page

getCasinoGamesProviders

Fetches a list of casino game providers.

getCasinoGamesProviders(): Promise<CasinoProviderType[]>

Description:
This method retrieves a list of all available casino game providers. It uses a caching mechanism to optimize performance - first checking if data is available in the cache before making an API call. If the API call fails, it attempts to return stale data from the cache.

Parameters:
None

Returns:
A Promise that resolves to an array of CasinoProviderType objects with the following properties:

PropertyTypeDescription
_idstringInternal identifier
providerIdstringUnique identifier for the provider (optional)
namestringDisplay name of the provider

Example:

// Get all game providers
const providers = await sdk.Catalog.getCasinoGamesProviders();
console.log(providers);
// [
// { _id: "123", providerId: "netent", name: "NetEnt" },
// { _id: "456", providerId: "microgaming", name: "Microgaming" },
// ...
// ]

GameCategory

type GameCategory = {
categoryId: string;
categoryName: string;
_id: string;
};

GameFilterRequest

interface GameFilterRequest extends Omit<PaginationRequest, 'sortBy'> {
idOrName?: string;
gameName?: string;
gameId?: string;
gameProvider?: string;
gameCategory?: string;
}

GameType

type GameType = {
_id: string;
gameId: string;
name: string;
providerId: {
providerId: string;
name: string;
};
categoryId: {
categoryId: string;
name: string;
};
device: string[];
gameThumbnail: string;
widgetThumbnail: string;
gameLaunch: string;
gameLaunchI18n: GameLaunchI18nType;
bonusBuyAllow: boolean;
};

CasinoProviderType

type CasinoProviderType = {
_id: string;
providerId?: string;
name: string;
};

GameLaunchI18nType

type GameLaunchI18nType = {
[locale: string]: {
locale: string;
url: string;
};
};

PaginationResponse

interface PaginationResponse<T> {
docs: T;
hasNextPage: boolean;
hasPrevPage: boolean;
limit: number;
nextPage: number;
page: number;
pagingCounter: number;
prevPage: number | null;
totalDocs: number;
totalPages: number;
}