// Compatibility wrapper for Hey API generated SDK import { createClient } from '@hey-api/client-fetch'; import * as sdk from './generated/sdk.gen'; export class EasychampAI { private _client: any; // Resource instances public champLeagues: any; public champs: any; public teams: any; public player: any; public sportKinds: any; public stage: any; public fixture: any; public group: any; public chat: any; constructor(options: any) { // Initialize Hey API client this._client = createClient({ baseUrl: options.baseURL || options.baseUrl || process.env['EASYCHAMP_AI_BASE_URL'] || process.env['EASYCHAMP_BASE_URL'] || 'https://easychamp.com/ec-standings-api', headers: { Authorization: options.apiKey ? `Bearer ${options.apiKey}` : undefined, ...options.defaultHeaders, }, }); // Initialize resources to maintain compatibility this.initializeResources(); } private initializeResources() { // Create resource objects that match the existing API this.champLeagues = { searchChampLeagues: (params?: any) => sdk.searchChampLeagues({ query: params, client: this._client }), createChampLeague: (body?: any) => sdk.createChampLeague({ body, client: this._client }), deleteChampLeague: (name: string) => sdk.deleteChampLeague({ path: { name }, client: this._client }), getChampLeague: (name: string) => sdk.getChampLeague({ path: { name }, client: this._client }), updateChampLeague: (name: string, body: any) => sdk.updateChampLeague({ path: { name }, body, client: this._client }), searchOneChampLeagueByName: (params: any) => sdk.searchOneChampLeagueByName({ query: params, client: this._client }), getChampLeagueChamps: (name: string, params?: any) => sdk.getChampLeagueChamps({ path: { name }, query: params, client: this._client }), getTeamsOfChampLeague: (name: string, params?: any) => sdk.getTeamsOfChampLeague({ path: { name }, query: params, client: this._client }), addNewsToChampLeague: (name: string, body: any) => sdk.addNewsToChampLeague({ path: { name }, body, client: this._client }), getMyLeagues: (params?: any) => sdk.getMyLeagues({ query: params, client: this._client }), getUserLeagues: (params?: any) => sdk.getUserLeagues({ query: params, client: this._client }), postAioptimizeChampLeaguesCreateLeagueAndCup: (body?: any) => sdk.postAioptimizeChampLeaguesCreateLeagueAndCup({ body, client: this._client }), postAioptimizeChampLeaguesCreateNoContentType: () => sdk.postAioptimizeChampLeaguesCreateNoContentType({ client: this._client }), }; this.champs = { searchChamps: (params?: any) => sdk.searchChamps({ query: params, client: this._client }), createChamp: (body?: any) => sdk.createChamp({ body, client: this._client }), deleteChamp: (name: string) => sdk.deleteChamp({ path: { name }, client: this._client }), getChampByName: (name: string) => sdk.getChampByName({ path: { name }, client: this._client }), getChampStandings: (name: string, params?: any) => sdk.getChampStandings({ path: { name }, query: params, client: this._client }), getVenuesOfChamp: (name: string) => sdk.getVenuesOfChamp({ path: { name }, client: this._client }), getStagePlayerStatsForChamp: (name: string, params?: any) => sdk.getStagePlayerStatsForChamp({ path: { name }, query: params, client: this._client }), updateChampByName: (name: string, body: any) => sdk.updateChampByName({ path: { name }, body, client: this._client }), addStageToChampByName: (name: string, body: any) => sdk.addStageToChampByName({ path: { name }, body, client: this._client }), getChampFixtures: (name: string, params?: any) => sdk.getChampFixtures({ path: { name }, query: params, client: this._client }), updateChampById: (id: string, body: any) => sdk.updateChampById({ path: { id }, body, client: this._client }), updateChampByNameDirect: (champName: string, body: any) => sdk.updateChampByNameDirect({ path: { champName }, body, client: this._client }), addStageToChampById: (id: string, body: any) => sdk.addStageToChampById({ path: { id }, body, client: this._client }), addTeamsToCompetitionByName: (champName: string, body: any) => sdk.addTeamsToCompetitionByName({ path: { champName }, body, client: this._client }), postAioptimizeChampsByIdTeams: (id: string, body: any) => sdk.postAioptimizeChampsByIdTeams({ path: { id }, body, client: this._client }), postAioptimizeChampsByIdTeamRoster: (id: string, body: any) => sdk.postAioptimizeChampsByIdTeamRoster({ path: { id }, body, client: this._client }), postAioptimizeChampsByIdGenerateBracket: (id: string, body: any) => sdk.postAioptimizeChampsByIdGenerateBracket({ path: { id }, body, client: this._client }), patchAioptimizeChampsByIdLineupTracking: (id: string, body: any) => sdk.patchAioptimizeChampsByIdLineupTracking({ path: { id }, body, client: this._client }), getAioptimizeChampsByNameMatches: (name: string, params?: any) => sdk.getAioptimizeChampsByNameMatches({ path: { name }, query: params, client: this._client }), }; this.teams = { filterTeams: (params?: any) => sdk.filterTeams({ query: params, client: this._client }), searchTeamByName: (params: any) => sdk.searchTeamByName({ query: params, client: this._client }), deleteTeam: (name: string) => sdk.deleteTeam({ path: { name }, client: this._client }), getTeamByName: (name: string) => sdk.getTeamByName({ path: { name }, client: this._client }), updateTeam: (name: string, body: any) => sdk.updateTeam({ path: { name }, body, client: this._client }), createTeamPlayer: (name: string, body: any) => sdk.createTeamPlayer({ path: { name }, body, client: this._client }), createTeam: (body: any) => sdk.createTeam({ body, client: this._client }), // These endpoints don't accept query parameters getTeamPlayers: (name: string) => sdk.getTeamPlayers({ path: { name }, client: this._client }), getUserTotalStats: (name: string) => sdk.getUserTotalStats({ path: { name }, client: this._client }), }; this.player = { searchPlayers: (params?: any) => sdk.searchPlayers({ query: params, client: this._client }), deletePlayer: (name: string) => { // Player endpoints use combined name as path parameter return sdk.deletePlayer({ path: { name }, client: this._client }); }, getPlayerByName: (name: string) => { // Player endpoints use combined name as path parameter return sdk.getPlayerByName({ path: { name }, client: this._client }); }, updatePlayer: (name: string, body: any) => { // Player endpoints use combined name as path parameter return sdk.updatePlayer({ path: { name }, body, client: this._client }); }, getStagePlayerStats: (name: string, params?: any) => sdk.getStagePlayerStats({ path: { name }, query: params, client: this._client }), // This endpoint doesn't accept query parameters getOverallPlayerStats: (name: string) => sdk.getOverallPlayerStats({ path: { name }, client: this._client }), createPlayer: (body: any) => sdk.createPlayer({ body, client: this._client }), }; this.sportKinds = { getAllSportKinds: () => sdk.getAllSportKinds({ client: this._client }), searchSportKinds: (params?: any) => sdk.searchSportKinds({ query: params, client: this._client }), getSportKindByName: (name: string) => sdk.getSportKindByName({ path: { name }, client: this._client }), getSportKindById: (id: string) => sdk.getSportKindById({ path: { id }, client: this._client }), }; this.stage = { deleteStage: (id: string, params?: any) => sdk.deleteAioptimizeStageById({ path: { id }, query: params, client: this._client }), getStage: (id: string) => sdk.getAioptimizeStageById({ path: { id }, client: this._client }), updateStage: (id: string, body: any) => sdk.putAioptimizeStageById({ path: { id }, body, client: this._client }), // This endpoint doesn't accept query parameters getStageStandings: (id: string) => sdk.getAioptimizeStageByIdStandings({ path: { id }, client: this._client }), generateFixtures: (id: string, body: any) => sdk.postAioptimizeStageByIdGenerateFixtures({ path: { id }, body, client: this._client }), }; this.fixture = { getFixture: (id: string) => sdk.getAioptimizeFixtureById({ path: { id }, client: this._client }), updateFixture: (id: string, body: any) => sdk.putAioptimizeFixtureById({ path: { id }, body, client: this._client }), updateFixtureResult: (id: string, body: any) => sdk.putAioptimizeFixtureByIdResult({ path: { id }, body, client: this._client }), addFixtureEvent: (id: string, body: any) => sdk.postAioptimizeFixtureByIdEvent({ path: { id }, body, client: this._client }), addFixtureEventsBatch: (id: string, body: any) => sdk.postAioptimizeFixtureByIdEventsBatch({ path: { id }, body, client: this._client }), updateHomeSquad: (id: string, body: any) => sdk.putAioptimizeFixtureByIdHomesquad({ path: { id }, body, client: this._client }), updateAwaySquad: (id: string, body: any) => sdk.putAioptimizeFixtureByIdAwaysquad({ path: { id }, body, client: this._client }), // This endpoint doesn't accept query parameters getFixturePlayers: (id: string) => sdk.getAioptimizeFixtureByIdPlayers({ path: { id }, client: this._client }), }; this.group = { createGroupFixture: (id: string, body: any) => sdk.postAioptimizeGroupByIdFixture({ path: { id }, body, client: this._client }), // This endpoint doesn't accept query parameters getGroupFixtures: (id: string) => sdk.getAioptimizeGroupByIdFixtures({ path: { id }, client: this._client }), }; this.chat = { query: (params?: any) => sdk.chatQueryChampsGet({ query: params, client: this._client }), send: (body: any) => sdk.chatQueryChampsPost({ body, client: this._client }), // Add the method with the exact name expected by MCP tools chatQueryChampsGet: (params?: any) => sdk.chatQueryChampsGet({ query: params, client: this._client }), chatQueryChampsPost: (body: any) => sdk.chatQueryChampsPost({ body, client: this._client }), }; } } export default EasychampAI;