@varandas/clash-royale-api
Version:
A Clash Royale API official wrapper for seamless integration with your applications.
39 lines • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGlobalTournaments = exports.getTournamentByTag = exports.getTournaments = void 0;
/**
* Search all tournaments by name.
*
* It is not possible to specify ordering for results so clients
* should not rely on any specific ordering as that may change in the future releases of the API.
*
* @param params
* @param {AxiosInstance} apiClient
*/
const getTournaments = async (params, apiClient) => {
const tournaments = await apiClient.get('/tournaments', { params });
return tournaments.data.items;
};
exports.getTournaments = getTournaments;
/**
* Get information about a single tournament by a tournament tag.
*
* @param {string} tag
* @param {AxiosInstance} apiClient
*/
const getTournamentByTag = async (tag, apiClient) => {
const tournament = await apiClient.get(`/tournaments/${encodeURIComponent(tag)}`);
return tournament.data;
};
exports.getTournamentByTag = getTournamentByTag;
/**
* List all available global tournaments.
*
* @param {AxiosInstance} apiClient
*/
const getGlobalTournaments = async (apiClient) => {
const globalTournaments = await apiClient.get('/globaltournaments');
return globalTournaments.data.items;
};
exports.getGlobalTournaments = getGlobalTournaments;
//# sourceMappingURL=tournaments.endpoint.js.map