Class: RESTManager
Represents a REST Manager of the client.
Hierarchy
EventEmitter
↳
RESTManager
Constructors
constructor
• new RESTManager(options?
)
Parameters
Name | Type |
---|---|
options? | RESTOptions |
Defined in
Properties
emit
• emit: <K>(event
: K
, ...args
: IRestEvents
[K
]) => boolean
& <S>(event
: Exclude
<S
, keyof IRestEvents
>, ...args
: any
[]) => boolean
Defined in
off
• off: <K>(event
: K
, listener
: (...args
: IRestEvents
[K
]) => void
) => RESTManager
& <S>(event
: Exclude
<S
, keyof IRestEvents
>, listener
: (...args
: any
[]) => void
) => RESTManager
Defined in
on
• on: <K>(event
: K
, listener
: (...args
: IRestEvents
[K
]) => void
) => RESTManager
& <S>(event
: Exclude
<S
, keyof IRestEvents
>, listener
: (...args
: any
[]) => void
) => RESTManager
Defined in
once
• once: <K>(event
: K
, listener
: (...args
: IRestEvents
[K
]) => void
) => RESTManager
& <S>(event
: Exclude
<S
, keyof IRestEvents
>, listener
: (...args
: any
[]) => void
) => RESTManager
Defined in
removeAllListeners
• removeAllListeners: <K>(event?
: K
) => RESTManager
& <S>(event?
: Exclude
<S
, keyof IRestEvents
>) => RESTManager
Defined in
requestHandler
• requestHandler: RequestHandler
Request Handler for the RESTManager.
Defined in
Accessors
util
• get
util(): typeof Util
Contains various general-purpose utility methods.
Returns
typeof Util
Defined in
Methods
login
▸ login(options
): Promise
<string
[]>
Initialize the client to create keys.
Parameters
Name | Type |
---|---|
options | LoginOptions |
Returns
Promise
<string
[]>
Example
const rest = new RESTManager();
rest.login({ email: 'developer@email.com', password: '***' });
Defined in
setKeys
▸ setKeys(keys
): RESTManager
Set Clash of Clans API keys.
Parameters
Name | Type |
---|---|
keys | string [] |
Returns
Defined in
getClans
▸ getClans(query
, options?
): Promise
<Result
<APIClanList
>>
Search all clans by name and/or filtering the results using various criteria.
Parameters
Name | Type |
---|---|
query | ClanSearchOptions |
options? | OverrideOptions |
Returns
Promise
<Result
<APIClanList
>>
Defined in
getClan
▸ getClan(clanTag
, options?
): Promise
<Result
<APIClan
>>
Get info about a clan.
Parameters
Name | Type |
---|---|
clanTag | string |
options? | OverrideOptions |
Returns
Defined in
getClanMembers
▸ getClanMembers(clanTag
, options?
): Promise
<Result
<APIClanMemberList
>>
Get list of clan members.
Parameters
Name | Type |
---|---|
clanTag | string |
options? | SearchOptions |
Returns
Promise
<Result
<APIClanMemberList
>>
Defined in
getClanWarLog
▸ getClanWarLog(clanTag
, options?
): Promise
<Result
<APIClanWarLogList
>>
Get clan war log.
Parameters
Name | Type |
---|---|
clanTag | string |
options? | SearchOptions |
Returns
Promise
<Result
<APIClanWarLogList
>>
Defined in
getCurrentWar
▸ getCurrentWar(clanTag
, options?
): Promise
<Result
<APIClanWar
>>
Get info about currently running war in the clan.
Parameters
Name | Type |
---|---|
clanTag | string |
options? | OverrideOptions |
Returns
Promise
<Result
<APIClanWar
>>
Defined in
getClanWarLeagueGroup
▸ getClanWarLeagueGroup(clanTag
, options?
): Promise
<Result
<APIClanWarLeagueGroup
>>
Get info about clan war league.
Parameters
Name | Type |
---|---|
clanTag | string |
options? | OverrideOptions |
Returns
Promise
<Result
<APIClanWarLeagueGroup
>>
Defined in
getClanWarLeagueRound
▸ getClanWarLeagueRound(warTag
, options?
): Promise
<Result
<APIClanWar
>>
Get info about a CWL round by WarTag.
Parameters
Name | Type |
---|---|
warTag | string |
options? | OverrideOptions |
Returns
Promise
<Result
<APIClanWar
>>
Defined in
getCapitalRaidSeasons
▸ getCapitalRaidSeasons(tag
, options?
): Promise
<Result
<APICapitalRaidSeasons
>>
Retrieve clan's capital raid seasons.
Parameters
Name | Type |
---|---|
tag | string |
options? | SearchOptions |
Returns
Promise
<Result
<APICapitalRaidSeasons
>>
Defined in
getPlayer
▸ getPlayer(playerTag
, options?
): Promise
<Result
<APIPlayer
>>
Get info about a player by tag.
Parameters
Name | Type |
---|---|
playerTag | string |
options? | OverrideOptions |
Returns
Defined in
verifyPlayerToken
▸ verifyPlayerToken(playerTag
, token
, options?
): Promise
<Result
<APIVerifyToken
>>
Verify Player API token that can be found from the Game settings.
Parameters
Name | Type |
---|---|
playerTag | string |
token | string |
options? | OverrideOptions |
Returns
Promise
<Result
<APIVerifyToken
>>
Defined in
getLeagues
▸ getLeagues(options?
): Promise
<Result
<APILeagueList
>>
Get a list of Leagues.
Parameters
Name | Type |
---|---|
options? | SearchOptions |
Returns
Promise
<Result
<APILeagueList
>>
Defined in
getLeague
▸ getLeague(leagueId
, options?
): Promise
<Result
<APILeague
>>
Get a League info.
Parameters
Name | Type |
---|---|
leagueId | string | number |
options? | OverrideOptions |
Returns
Defined in
getBuilderBaseLeagues
▸ getBuilderBaseLeagues(options?
): Promise
<Result
<APIBuilderBaseLeagueList
>>
Get a list of builder base leagues.
Parameters
Name | Type |
---|---|
options? | SearchOptions |
Returns
Promise
<Result
<APIBuilderBaseLeagueList
>>
Defined in
getBuilderBaseLeague
▸ getBuilderBaseLeague(leagueId
, options?
): Promise
<Result
<APIBuilderBaseLeague
>>
Get a builder base league info.
Parameters
Name | Type |
---|---|
leagueId | string | number |
options? | OverrideOptions |
Returns
Promise
<Result
<APIBuilderBaseLeague
>>
Defined in
getCapitalLeagues
▸ getCapitalLeagues(options?
): Promise
<Result
<APICapitalLeagueList
>>
Get a list of Capital leagues.
Parameters
Name | Type |
---|---|
options? | SearchOptions |
Returns
Promise
<Result
<APICapitalLeagueList
>>
Defined in
getCapitalLeague
▸ getCapitalLeague(leagueId
, options?
): Promise
<Result
<APICapitalLeague
>>
Get a Capital League info.
Parameters
Name | Type |
---|---|
leagueId | string | number |
options? | OverrideOptions |
Returns
Promise
<Result
<APICapitalLeague
>>
Defined in
getLeagueSeasons
▸ getLeagueSeasons(leagueId
, options?
): Promise
<Result
<APILeagueSeasonList
>>
Get Legend League season Ids.
Parameters
Name | Type |
---|---|
leagueId | number |
options? | SearchOptions |
Returns
Promise
<Result
<APILeagueSeasonList
>>
Defined in
getSeasonRankings
▸ getSeasonRankings(leagueId
, seasonId
, options?
): Promise
<Result
<APIPlayerSeasonRankingList
>>
Get Legend League season rankings by season Id.
Parameters
Name | Type |
---|---|
leagueId | number |
seasonId | string |
options? | SearchOptions |
Returns
Promise
<Result
<APIPlayerSeasonRankingList
>>
Defined in
getWarLeagues
▸ getWarLeagues(options?
): Promise
<Result
<APIWarLeagueList
>>
Get list of Clan War Leagues.
Parameters
Name | Type |
---|---|
options? | SearchOptions |
Returns
Promise
<Result
<APIWarLeagueList
>>
Defined in
getWarLeague
▸ getWarLeague(leagueId
, options?
): Promise
<Result
<APIWarLeague
>>
Get info about a Clan War League.
Parameters
Name | Type |
---|---|
leagueId | number |
options? | OverrideOptions |
Returns
Promise
<Result
<APIWarLeague
>>
Defined in
getLocations
▸ getLocations(options?
): Promise
<Result
<APILocationList
>>
Get list of Locations.
Parameters
Name | Type |
---|---|
options? | SearchOptions |
Returns
Promise
<Result
<APILocationList
>>
Defined in
getLocation
▸ getLocation(locationId
, options?
): Promise
<Result
<APILocation
>>
Get info about a Location.
Parameters
Name | Type |
---|---|
locationId | number |
options? | OverrideOptions |
Returns
Promise
<Result
<APILocation
>>
Defined in
getClanRanks
▸ getClanRanks(locationId
, options?
): Promise
<Result
<APIClanRankingList
>>
Get clan rankings for a specific location.
Parameters
Name | Type |
---|---|
locationId | string | number |
options? | SearchOptions |
Returns
Promise
<Result
<APIClanRankingList
>>
Defined in
getPlayerRanks
▸ getPlayerRanks(locationId
, options?
): Promise
<Result
<APIPlayerRankingList
>>
Get player rankings for a specific location.
Parameters
Name | Type |
---|---|
locationId | string | number |
options? | SearchOptions |
Returns
Promise
<Result
<APIPlayerRankingList
>>
Defined in
getBuilderBaseClanRanks
▸ getBuilderBaseClanRanks(locationId
, options?
): Promise
<Result
<APIClanBuilderBaseRankingList
>>
Get clan builder base rankings for a specific location.
Parameters
Name | Type |
---|---|
locationId | string | number |
options? | SearchOptions |
Returns
Promise
<Result
<APIClanBuilderBaseRankingList
>>
Defined in
getBuilderBasePlayerRanks
▸ getBuilderBasePlayerRanks(locationId
, options?
): Promise
<Result
<APIPlayerBuilderBaseRankingList
>>
Get player builder base rankings for a specific location.
Parameters
Name | Type |
---|---|
locationId | string | number |
options? | SearchOptions |
Returns
Promise
<Result
<APIPlayerBuilderBaseRankingList
>>
Defined in
getClanCapitalRanks
▸ getClanCapitalRanks(locationId
, options?
): Promise
<Result
<APIClanCapitalRankingList
>>
Get clan capital rankings for a specific location.
Parameters
Name | Type |
---|---|
locationId | string | number |
options? | SearchOptions |
Returns
Promise
<Result
<APIClanCapitalRankingList
>>
Defined in
getClanLabels
▸ getClanLabels(options?
): Promise
<Result
<APILabelList
>>
Get list of clan labels.
Parameters
Name | Type |
---|---|
options? | SearchOptions |
Returns
Promise
<Result
<APILabelList
>>
Defined in
getPlayerLabels
▸ getPlayerLabels(options?
): Promise
<Result
<APILabelList
>>
Get list of player labels.
Parameters
Name | Type |
---|---|
options? | SearchOptions |
Returns
Promise
<Result
<APILabelList
>>
Defined in
getGoldPassSeason
▸ getGoldPassSeason(options?
): Promise
<Result
<APIGoldPassSeason
>>
Get info about gold pass season.
Parameters
Name | Type |
---|---|
options? | OverrideOptions |
Returns
Promise
<Result
<APIGoldPassSeason
>>
Defined in
Events
debug
• debug: string
Emitted for general debugging information.
Defined in
error
• error: string
Emitted when the client encounters an error.
Defined in
rateLimited
• rateLimited: string
Emitted when the client is rate limited.