Skip to main content

Class: RESTManager

Represents a REST Manager of the client.

Hierarchy

  • EventEmitter

    RESTManager

Constructors

constructor

new RESTManager(options?)

Parameters

NameType
options?RESTOptions

Defined in

rest/RESTManager.ts:90

Properties

emit

emit: <K>(event: K, ...args: IRestEvents[K]) => boolean & <S>(event: Exclude<S, keyof IRestEvents>, ...args: any[]) => boolean

Defined in

rest/RESTManager.ts:48


off

off: <K>(event: K, listener: (...args: IRestEvents[K]) => void) => RESTManager & <S>(event: Exclude<S, keyof IRestEvents>, listener: (...args: any[]) => void) => RESTManager

Defined in

rest/RESTManager.ts:51


on

on: <K>(event: K, listener: (...args: IRestEvents[K]) => void) => RESTManager & <S>(event: Exclude<S, keyof IRestEvents>, listener: (...args: any[]) => void) => RESTManager

Defined in

rest/RESTManager.ts:54


once

once: <K>(event: K, listener: (...args: IRestEvents[K]) => void) => RESTManager & <S>(event: Exclude<S, keyof IRestEvents>, listener: (...args: any[]) => void) => RESTManager

Defined in

rest/RESTManager.ts:57


removeAllListeners

removeAllListeners: <K>(event?: K) => RESTManager & <S>(event?: Exclude<S, keyof IRestEvents>) => RESTManager

Defined in

rest/RESTManager.ts:60


requestHandler

requestHandler: RequestHandler

Request Handler for the RESTManager.

Defined in

rest/RESTManager.ts:88

Accessors

util

get util(): typeof Util

Contains various general-purpose utility methods.

Returns

typeof Util

Defined in

rest/RESTManager.ts:100

Methods

login

login(options): Promise<string[]>

Initialize the client to create keys.

Parameters

NameType
optionsLoginOptions

Returns

Promise<string[]>

Example

const rest = new RESTManager();
rest.login({ email: 'developer@email.com', password: '***' });

Defined in

rest/RESTManager.ts:112


setKeys

setKeys(keys): RESTManager

Set Clash of Clans API keys.

Parameters

NameType
keysstring[]

Returns

RESTManager

Defined in

rest/RESTManager.ts:117


getClans

getClans(query, options?): Promise<Result<APIClanList>>

Search all clans by name and/or filtering the results using various criteria.

Parameters

NameType
queryClanSearchOptions
options?OverrideOptions

Returns

Promise<Result<APIClanList>>

Defined in

rest/RESTManager.ts:123


getClan

getClan(clanTag, options?): Promise<Result<APIClan>>

Get info about a clan.

Parameters

NameType
clanTagstring
options?OverrideOptions

Returns

Promise<Result<APIClan>>

Defined in

rest/RESTManager.ts:128


getClanMembers

getClanMembers(clanTag, options?): Promise<Result<APIClanMemberList>>

Get list of clan members.

Parameters

NameType
clanTagstring
options?SearchOptions

Returns

Promise<Result<APIClanMemberList>>

Defined in

rest/RESTManager.ts:133


getClanWarLog

getClanWarLog(clanTag, options?): Promise<Result<APIClanWarLogList>>

Get clan war log.

Parameters

NameType
clanTagstring
options?SearchOptions

Returns

Promise<Result<APIClanWarLogList>>

Defined in

rest/RESTManager.ts:139


getCurrentWar

getCurrentWar(clanTag, options?): Promise<Result<APIClanWar>>

Get info about currently running war in the clan.

Parameters

NameType
clanTagstring
options?OverrideOptions

Returns

Promise<Result<APIClanWar>>

Defined in

rest/RESTManager.ts:145


getClanWarLeagueGroup

getClanWarLeagueGroup(clanTag, options?): Promise<Result<APIClanWarLeagueGroup>>

Get info about clan war league.

Parameters

NameType
clanTagstring
options?OverrideOptions

Returns

Promise<Result<APIClanWarLeagueGroup>>

Defined in

rest/RESTManager.ts:150


getClanWarLeagueRound

getClanWarLeagueRound(warTag, options?): Promise<Result<APIClanWar>>

Get info about a CWL round by WarTag.

Parameters

NameType
warTagstring
options?OverrideOptions

Returns

Promise<Result<APIClanWar>>

Defined in

rest/RESTManager.ts:155


getCapitalRaidSeasons

getCapitalRaidSeasons(tag, options?): Promise<Result<APICapitalRaidSeasons>>

Retrieve clan's capital raid seasons.

Parameters

NameType
tagstring
options?SearchOptions

Returns

Promise<Result<APICapitalRaidSeasons>>

Defined in

rest/RESTManager.ts:160


getPlayer

getPlayer(playerTag, options?): Promise<Result<APIPlayer>>

Get info about a player by tag.

Parameters

NameType
playerTagstring
options?OverrideOptions

Returns

Promise<Result<APIPlayer>>

Defined in

rest/RESTManager.ts:166


verifyPlayerToken

verifyPlayerToken(playerTag, token, options?): Promise<Result<APIVerifyToken>>

Verify Player API token that can be found from the Game settings.

Parameters

NameType
playerTagstring
tokenstring
options?OverrideOptions

Returns

Promise<Result<APIVerifyToken>>

Defined in

rest/RESTManager.ts:171


getLeagues

getLeagues(options?): Promise<Result<APILeagueList>>

Get a list of Leagues.

Parameters

NameType
options?SearchOptions

Returns

Promise<Result<APILeagueList>>

Defined in

rest/RESTManager.ts:180


getLeague

getLeague(leagueId, options?): Promise<Result<APILeague>>

Get a League info.

Parameters

NameType
leagueIdstring | number
options?OverrideOptions

Returns

Promise<Result<APILeague>>

Defined in

rest/RESTManager.ts:186


getBuilderBaseLeagues

getBuilderBaseLeagues(options?): Promise<Result<APIBuilderBaseLeagueList>>

Get a list of builder base leagues.

Parameters

NameType
options?SearchOptions

Returns

Promise<Result<APIBuilderBaseLeagueList>>

Defined in

rest/RESTManager.ts:191


getBuilderBaseLeague

getBuilderBaseLeague(leagueId, options?): Promise<Result<APIBuilderBaseLeague>>

Get a builder base league info.

Parameters

NameType
leagueIdstring | number
options?OverrideOptions

Returns

Promise<Result<APIBuilderBaseLeague>>

Defined in

rest/RESTManager.ts:197


getCapitalLeagues

getCapitalLeagues(options?): Promise<Result<APICapitalLeagueList>>

Get a list of Capital leagues.

Parameters

NameType
options?SearchOptions

Returns

Promise<Result<APICapitalLeagueList>>

Defined in

rest/RESTManager.ts:202


getCapitalLeague

getCapitalLeague(leagueId, options?): Promise<Result<APICapitalLeague>>

Get a Capital League info.

Parameters

NameType
leagueIdstring | number
options?OverrideOptions

Returns

Promise<Result<APICapitalLeague>>

Defined in

rest/RESTManager.ts:208


getLeagueSeasons

getLeagueSeasons(leagueId, options?): Promise<Result<APILeagueSeasonList>>

Get Legend League season Ids.

Parameters

NameType
leagueIdnumber
options?SearchOptions

Returns

Promise<Result<APILeagueSeasonList>>

Defined in

rest/RESTManager.ts:213


getSeasonRankings

getSeasonRankings(leagueId, seasonId, options?): Promise<Result<APIPlayerSeasonRankingList>>

Get Legend League season rankings by season Id.

Parameters

NameType
leagueIdnumber
seasonIdstring
options?SearchOptions

Returns

Promise<Result<APIPlayerSeasonRankingList>>

Defined in

rest/RESTManager.ts:219


getWarLeagues

getWarLeagues(options?): Promise<Result<APIWarLeagueList>>

Get list of Clan War Leagues.

Parameters

NameType
options?SearchOptions

Returns

Promise<Result<APIWarLeagueList>>

Defined in

rest/RESTManager.ts:225


getWarLeague

getWarLeague(leagueId, options?): Promise<Result<APIWarLeague>>

Get info about a Clan War League.

Parameters

NameType
leagueIdnumber
options?OverrideOptions

Returns

Promise<Result<APIWarLeague>>

Defined in

rest/RESTManager.ts:231


getLocations

getLocations(options?): Promise<Result<APILocationList>>

Get list of Locations.

Parameters

NameType
options?SearchOptions

Returns

Promise<Result<APILocationList>>

Defined in

rest/RESTManager.ts:236


getLocation

getLocation(locationId, options?): Promise<Result<APILocation>>

Get info about a Location.

Parameters

NameType
locationIdnumber
options?OverrideOptions

Returns

Promise<Result<APILocation>>

Defined in

rest/RESTManager.ts:242


getClanRanks

getClanRanks(locationId, options?): Promise<Result<APIClanRankingList>>

Get clan rankings for a specific location.

Parameters

NameType
locationIdstring | number
options?SearchOptions

Returns

Promise<Result<APIClanRankingList>>

Defined in

rest/RESTManager.ts:247


getPlayerRanks

getPlayerRanks(locationId, options?): Promise<Result<APIPlayerRankingList>>

Get player rankings for a specific location.

Parameters

NameType
locationIdstring | number
options?SearchOptions

Returns

Promise<Result<APIPlayerRankingList>>

Defined in

rest/RESTManager.ts:253


getBuilderBaseClanRanks

getBuilderBaseClanRanks(locationId, options?): Promise<Result<APIClanBuilderBaseRankingList>>

Get clan builder base rankings for a specific location.

Parameters

NameType
locationIdstring | number
options?SearchOptions

Returns

Promise<Result<APIClanBuilderBaseRankingList>>

Defined in

rest/RESTManager.ts:259


getBuilderBasePlayerRanks

getBuilderBasePlayerRanks(locationId, options?): Promise<Result<APIPlayerBuilderBaseRankingList>>

Get player builder base rankings for a specific location.

Parameters

NameType
locationIdstring | number
options?SearchOptions

Returns

Promise<Result<APIPlayerBuilderBaseRankingList>>

Defined in

rest/RESTManager.ts:268


getClanCapitalRanks

getClanCapitalRanks(locationId, options?): Promise<Result<APIClanCapitalRankingList>>

Get clan capital rankings for a specific location.

Parameters

NameType
locationIdstring | number
options?SearchOptions

Returns

Promise<Result<APIClanCapitalRankingList>>

Defined in

rest/RESTManager.ts:277


getClanLabels

getClanLabels(options?): Promise<Result<APILabelList>>

Get list of clan labels.

Parameters

NameType
options?SearchOptions

Returns

Promise<Result<APILabelList>>

Defined in

rest/RESTManager.ts:283


getPlayerLabels

getPlayerLabels(options?): Promise<Result<APILabelList>>

Get list of player labels.

Parameters

NameType
options?SearchOptions

Returns

Promise<Result<APILabelList>>

Defined in

rest/RESTManager.ts:289


getGoldPassSeason

getGoldPassSeason(options?): Promise<Result<APIGoldPassSeason>>

Get info about gold pass season.

Parameters

NameType
options?OverrideOptions

Returns

Promise<Result<APIGoldPassSeason>>

Defined in

rest/RESTManager.ts:295

Events

debug

debug: string

Emitted for general debugging information.

Defined in

rest/RESTManager.ts:68


error

error: string

Emitted when the client encounters an error.

Defined in

rest/RESTManager.ts:75


rateLimited

rateLimited: string

Emitted when the client is rate limited.

Defined in

rest/RESTManager.ts:82