Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ClashAPI

Hierarchy

  • ClashAPI

Index

Constructors

constructor

  • Creates a new ClashAPI instance

    Parameters

    • token: string

      Clash of Clans API Token

    Returns ClashAPI

Properties

cacheControl

cacheControl: Map<String, CacheControlContent> = ...

clans

clans: Clans

Protected token

token: string

Methods

fetchClanLabels

  • fetchClanLabels(): Promise<Label[]>

fetchCurrentGoldPassSeason

fetchLeague

  • fetchLeague(leagueId: number): Promise<League>
  • Get league information

    Parameters

    • leagueId: number

      Identifier of the league

    Returns Promise<League>

fetchLeagues

  • fetchLeagues(limit?: number, after?: string, before?: string): Promise<League[]>
  • List leagues

    Parameters

    • Optional limit: number

      Limit the number of items returned in the response.

    • Optional after: string

      Return only items that occur after this marker. Before marker can be found from the response, inside the 'paging' property. Note that only after or before can be specified for a request, not both.

    • Optional before: string

      Return only items that occur before this marker. Before marker can be found from the response, inside the 'paging' property. Note that only after or before can be specified for a request, not both.

    Returns Promise<League[]>

fetchLocation

  • fetchLocation(locationId: number): Promise<Location>
  • Get information about specific location

    Parameters

    • locationId: number

      Identifier of the location to retrieve.

    Returns Promise<Location>

fetchLocations

  • fetchLocations(limit?: number, after?: string, before?: string): Promise<Location[]>
  • List locations

    Parameters

    • Optional limit: number

      Limit the number of items returned in the response.

    • Optional after: string

      Return only items that occur after this marker. Before marker can be found from the response, inside the 'paging' property. Note that only after or before can be specified for a request, not both.

    • Optional before: string

      Return only items that occur before this marker. Before marker can be found from the response, inside the 'paging' property. Note that only after or before can be specified for a request, not both.

    Returns Promise<Location[]>

fetchPlayer

  • fetchPlayer(playerTag: string): Promise<Player>
  • Get information about a single player by player tag. Player tags can be found either in game or by from clan member lists.

    Parameters

    • playerTag: string

    Returns Promise<Player>

fetchPlayerLabels

  • fetchPlayerLabels(): Promise<Label[]>

fetchWarLeague

  • fetchWarLeague(leagueId: number): Promise<WarLeague>
  • Get war league information

    Parameters

    • leagueId: number

      Identifier of the league

    Returns Promise<WarLeague>

fetchWarLeagues

  • fetchWarLeagues(limit?: number, after?: string, before?: string): Promise<WarLeague[]>
  • List war leagues

    Parameters

    • Optional limit: number

      Limit the number of items returned in the response.

    • Optional after: string

      Return only items that occur after this marker. Before marker can be found from the response, inside the 'paging' property. Note that only after or before can be specified for a request, not both.

    • Optional before: string

      Return only items that occur before this marker. Before marker can be found from the response, inside the 'paging' property. Note that only after or before can be specified for a request, not both.

    Returns Promise<WarLeague[]>

get

  • get(endpoint: string): Promise<unknown>
  • internal method

    internal

    Parameters

    • endpoint: string

      endpoint

    Returns Promise<unknown>

post

  • post(endpoint: string, data: any, sendAs?: "json" | "buffer" | "form"): Promise<unknown>
  • internal method

    internal

    Parameters

    • endpoint: string

      endpoint

    • data: any

      body data

    • sendAs: "json" | "buffer" | "form" = "json"

      contentType (defaults to json)

    Returns Promise<unknown>

Made by Horyus. Documentation generated by TypeDoc.