@varandas/clash-royale-api
Version:
A Clash Royale API official wrapper for seamless integration with your applications.
62 lines • 2.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClanWarRankingsForLocation = exports.getPlayerRankingsForLocation = exports.getClanRankingsForLocation = exports.getLocationById = exports.getLocations = void 0;
/**
* List all available locations.
*
* @param {ILocationRequestParams} params
* @param {AxiosInstance} apiClient
*/
const getLocations = async (params, apiClient) => {
const locations = await apiClient.get('/locations', { params });
return locations.data.items;
};
exports.getLocations = getLocations;
/**
* Get information about specific location.
*
* @param {string} id
* @param {AxiosInstance} apiClient
*/
const getLocationById = async (id, apiClient) => {
const location = await apiClient.get(`/locations/${id}`);
return await location.data;
};
exports.getLocationById = getLocationById;
/**
* Get clan rankings for a specific location.
*
* @param {string} id
* @param {ILocationFullRequestParams} params
* @param {AxiosInstance} apiClient
*/
const getClanRankingsForLocation = async (id, params, apiClient) => {
const clanRankingsForLocation = await apiClient.get(`/locations/${id}/rankings/clans`, { params });
return clanRankingsForLocation.data.items;
};
exports.getClanRankingsForLocation = getClanRankingsForLocation;
/**
* Get player rankings for a specific location
*
* @param {string} id
* @param {ILocationFullRequestParams} params
* @param {AxiosInstance} apiClient
*/
const getPlayerRankingsForLocation = async (id, params, apiClient) => {
const playerRankingsForLocation = await apiClient.get(`/locations/${id}/rankings/players`, { params });
return await playerRankingsForLocation.data.items;
};
exports.getPlayerRankingsForLocation = getPlayerRankingsForLocation;
/**
* Get clan rankings for a specific location
*
* @param {string} id
* @param { ILocationFullRequestParams } params
* @param { AxiosInstance } apiClient
*/
const getClanWarRankingsForLocation = async (id, params, apiClient) => {
const clanWarRankingsForLocation = await apiClient.get(`/locations/${id}/rankings/clanwars`);
return await clanWarRankingsForLocation.data.items;
};
exports.getClanWarRankingsForLocation = getClanWarRankingsForLocation;
//# sourceMappingURL=locations.endpoint.js.map