diff --git a/src/api/catoffAPI.ts b/src/api/catoffAPI.ts index d338427..66c0f40 100644 --- a/src/api/catoffAPI.ts +++ b/src/api/catoffAPI.ts @@ -11,6 +11,7 @@ import { UpdatePlayerScoreRequest, UpdatePlayerScoreResponse, } from '../types/player'; +import { getGameIDRequest, GetGameIDResponse } from '../types/game'; export interface CatoffAPIOptions { apiKey: string; @@ -110,4 +111,18 @@ export class CatoffAPI { body: JSON.stringify(data), }); } + + /** + * Retrieves the details of a player in a challenge. + * + * @param data - Data required to get the game's ID. + * @returns A promise resolving to the Game's ID. + */ + + async getGameID(data: getGameIDRequest): Promise { + return this.request('game/findID', { + method: 'POST', + body: JSON.stringify(data), + }); + } } diff --git a/src/index.ts b/src/index.ts index 16a1545..8a794e3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ export { CatoffAPI, CatoffAPIOptions } from './api/catoffAPI'; export * from './types/challenge'; export * from './types/player'; +export * from './types/game'; export { ENVIRONMENT as CatoffEnv } from './config/env'; diff --git a/src/types/game.ts b/src/types/game.ts new file mode 100644 index 0000000..04412cb --- /dev/null +++ b/src/types/game.ts @@ -0,0 +1,50 @@ +export interface getGameIDRequest { + GameType: GAME_TYPE; + EsportAttribute: string[]; + ParticipationType: PARTICIPATION_TYPE; + EsportOption: ESPORTS_OPTIONS; +} + +export interface GetGameIDResponse { + GameID: number; +} + +enum ESPORTS_OPTIONS { + VALORANT = 'VALORANT', + FORTNITE = 'FORTNITE', + HALO_INFINITE = 'HALO_INFINITE', + LEAGUE_OF_LEGENDS = 'LEAGUE_OF_LEGENDS', + MARVEL_RIVALS = 'MARVEL_RIVALS', + MANUAL_GAMES = 'MANUAL_GAMES', + // CLASH_ROYALE = 'CLASH_ROYALE', + PUBG = 'PUBG', + RAINBOW_SIX_SIEGE = 'RAINBOW_SIX_SIEGE', + CS_GO = 'CS_GO', //change it later + CS_GO_DE_MIRAGE = 'CS_GO_DE_MIRAGE', + CS_GO_DE_DUST2 = 'CS_GO_DE_DUST2', + CS_GO_DE_ANUBIS = 'CS_GO_DE_ANUBIS', + CS_GO_DE_OVERPASS = 'CS_GO_DE_OVERPASS', + CS_GO_DE_NUKE = 'CS_GO_DE_NUKE', + CS_GO_DE_INFERNO = 'CS_GO_DE_INFERNO', + CS_GO_DE_ANCIENT = 'CS_GO_DE_ANCIENT', + CS_GO_DE_VERTIGO = 'CS_GO_DE_VERTIGO', + CS_GO_DE_MILLS = 'CS_GO_DE_MILLS', +} + +enum PARTICIPATION_TYPE { + ZERO_VS_ONE = 0, + ONE_VS_ONE = 1, + N_VS_N = 2, + ZERO_VS_ZERO = 3, // STREAMER MODE +} + +enum GAME_TYPE { + STEPS = 0, + CALORIES = 1, + DIGITAL_PROOF = 2, + VALIDATOR = 3, + VOTING = 4, + BATTLE_VALIDATOR = 5, + BATTLE_VOTING = 6, + ESPORTS_INDEXER = 7, +}