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:
Property | Type | Description |
---|---|---|
categoryId | string | Unique identifier for the category |
categoryName | string | Display name of the category |
_id | string | Internal 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:
Property | Type | Required | Description |
---|---|---|---|
page | number | Yes | Page number to retrieve (starting from 1) |
limit | number | Yes | Number of items per page |
order | 'asc' | 'desc' | No | Sort order |
idOrName | string | No | Filter by game ID or name |
gameName | string | No | Filter by exact game name |
gameId | string | No | Filter by exact game ID |
gameProvider | string | No | Filter by game provider |
gameCategory | string | No | Filter by game category |
Returns:
A Promise that resolves to a PaginationResponse<GameType[]>
object with the following structure:
Property | Type | Description |
---|---|---|
docs | GameType[] | Array of game objects matching the filter criteria |
hasNextPage | boolean | Whether there is a next page of results |
hasPrevPage | boolean | Whether there is a previous page of results |
limit | number | Number of items per page |
nextPage | number | Next page number |
page | number | Current page number |
pagingCounter | number | The starting index of first document |
prevPage | number | null | Previous page number or null if on first page |
totalDocs | number | Total number of documents matching the criteria |
totalPages | number | Total number of pages |
Each GameType
object in the docs
array has the following properties:
Property | Type | Description |
---|---|---|
_id | string | Internal identifier |
gameId | string | Unique identifier for the game |
name | string | Display name of the game |
providerId | object | Information about the game provider |
providerId.providerId | string | Unique identifier for the provider |
providerId.name | string | Name of the provider |
categoryId | object | Information about the game category |
categoryId.categoryId | string | Unique identifier for the category |
categoryId.name | string | Name of the category |
device | string[] | Array of supported device types |
gameThumbnail | string | URL to the game thumbnail image |
widgetThumbnail | string | URL to the widget thumbnail image |
gameLaunch | string | URL to launch the game |
gameLaunchI18n | object | Internationalized game launch URLs |
bonusBuyAllow | boolean | Whether 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:
Property | Type | Description |
---|---|---|
_id | string | Internal identifier |
providerId | string | Unique identifier for the provider (optional) |
name | string | Display 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" },
// ...
// ]
Related Interfaces
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;
}