@varandas/clash-royale-api
Version:
A Clash Royale API official wrapper for seamless integration with your applications.
147 lines (146 loc) • 4.98 kB
TypeScript
import { CardResponse, IBattleLog, IChest, IClan, IClanDetails, IClanMember, IClanRequestParams, ICurrentRiverRace, ICurrentWar, IGlobalTournaments, ILeaderboard, ILeaderboardPlayer, ILeaderboardRequestParams, ILocation, ILocationFullRequestParams, ILocationRequestParams, IPlayer, ITournament, ITournamentDetails, ITournamentRequestParams, IWarlog } from './interfaces';
/**
* @namespace ClashRoyaleAPI
*
* @class ClashRoyaleAPI
*/
export declare class ClashRoyaleAPI {
private readonly apiClient;
/**
* Initializes the axios instance with the token
* from the developer site https://developer.clashroyale.com
*
* @param {string} token - The api token from https://developer.clashroyale.com
* @param {string} baseUrl - The base url for the api (optional)
*/
constructor(token: string, baseUrl?: string);
/**
* Search all clans by name and/or filtering the results using various criteria.
*
* @param {object:IClanRequestParams} params - Object used to filter results.
*/
getClans(params: IClanRequestParams): Promise<IClan[]>;
/**
* Get information about a single clan by clan tag.
* Clan tags can be found using clan search operation.
*
* @param {string} tag
*/
getClanByTag(tag: string): Promise<IClanDetails>;
/**
* List clan members
*
* @param {string} tag
*/
getClanMembers(tag: string): Promise<IClanMember[]>;
/**
* Retrieve clan's clan war log
*
* @param {string} tag
*/
getClanWarlog(tag: string): Promise<IWarlog[]>;
/**
* Retrieve information about clan's current clan war
*
* Note:
* When ICurrentWar.warEndTime is undefined, the war is still in collection.
* Search for ICurrentWar.collectionEndTime instead
*
* @param {string} tag
*/
getClanCurrentWar(tag: string): Promise<ICurrentWar>;
/**
* Retrieve information about clan's current river race
*
* Note:
* When ICurrentWar.warEndTime is undefined, the war is still in collection.
* Search for ICurrentWar.collectionEndTime instead
*
* @param {string} tag
*/
getClanCurrentRiverRace(tag: string): Promise<ICurrentRiverRace>;
/**
* Get information about a single player by player tag.
* Player tags can be found either in game or by from clan member lists.
*
* @param {string} tag
*/
getPlayerByTag: (tag: string) => Promise<IPlayer>;
/**
* Get list of reward chests that the player will receive next in the game.
*
* @param {string} tag
*/
getPlayerUpcomingChests: (tag: string) => Promise<IChest[]>;
/**
* Get list of recent battle results for a player.
*
* @param {string} tag
*/
getPlayerBattleLog: (tag: string) => Promise<IBattleLog[]>;
/**
* Search all tournaments by name.
*
* @param {object:ITournamentRequestParams} params
*/
getTournaments: (params: ITournamentRequestParams) => Promise<ITournament[]>;
/**
* Get information about a single tournament by a tournament tag.
*
* @param {string} tag
*/
getTournamentByTag: (tag: string) => Promise<ITournamentDetails>;
/**
* List all available global tournaments.
*/
getGlobalTournaments: () => Promise<IGlobalTournaments[]>;
/**
* Get list of all available cards.
*/
getCards(): Promise<CardResponse>;
/**
* List all available locations
*
* @param {ILocationRequestParams} params
*/
getLocations(params: ILocationRequestParams): Promise<ILocation[]>;
/**
* Get information about specific location
*
* @param {string} id
* @param {ILocationFullRequestParams} params
*/
getLocationById(id: string): Promise<ILocation>;
/**
* Get clan rankings for a specific location.
*
* @param {string} id
* @param {ILocationFullRequestParams} params
*/
getClanRankinsForLocation(id: string, params: ILocationFullRequestParams): Promise<IClan[]>;
/**
* Get player rankings for a specific location
*
* @param {string} id
* @param {ILocationFullRequestParams} params
*/
getPlayerRankingsForLocation(id: string, params: ILocationFullRequestParams): Promise<IPlayer[]>;
/**
* Get clan rankings for a specific location
*
* @param {string} id
* @param {ILocationFullRequestParams} params
*/
getClanWarRankingsForLocation(id: string, params: ILocationFullRequestParams): Promise<IClan[]>;
/**
* List leaderboards for different trophy roads.
*/
getLeaderboards(): Promise<ILeaderboard[]>;
/**
* Get players on a specific leaderboard.
*
* @param {number} leaderboardId
* @param {ILeaderboardRequestParams} params
*/
getLeaderboardById(leaderboardId: number, params?: ILeaderboardRequestParams): Promise<ILeaderboardPlayer[]>;
}