ChampionManager class


A champion manager - to fetch and manage all the champion data. Does not require an API Key. (Except for ChampionManager.fetchRotations).

Signature:

export declare class ChampionManager implements BaseManager<Champion> 

Implements: BaseManager<Champion>

References: BaseManager, Champion


Constructor

new ChampionManager (client: Client)

Constructs a new instance of the ChampionManager class.

Parameters:

ParameterTypeDescription
clientClientThe client this champion manager belongs to.

Properties

client

The client that this champion manager belongs to.

Type: Client


Methods

.fetch ()

Fetches a champion by the champion ID.

Signature:

fetch(id: string, options?: FetchOptions): Promise<Champion>;

Parameters:

ParameterTypeDescription
idStringThe ID of the champion whose data needs to be fetched.
optionsFetchOptionsThe basic fetching options.

Return type: Promise < Champion >


.fetchAll ()

Fetch all the champions and store it in the cache.

This always fetches freshly from data dragon, community dragon and meraki analytics.

Signature:

fetchAll(options?: FetchOptions): Promise<Collection<string, Champion>>;

Parameters:

ParameterTypeDescription
optionsFetchOptionsThe basic fetching options (only cache and store affect this method).

Return type: Promise < Collection < String, Champion > >


.fetchByKey ()

Fetch and cache champion by their unique 3-digit keys.

This is mostly for internal use while fetching match (or live match) data to improve performance.

Signature:

fetchByKey(key: number, options?: FetchOptions): Promise<Champion | undefined>;

Parameters:

ParameterTypeDescription
keyNumberThe key of the champions to fetch.
optionsFetchOptionsThe basic fetching options.

Return type: Promise < Champion | Undefined >


.fetchByKeys ()

Fetch and cache champions by their unique 3-digit keys.

This is mostly for internal use while fetching match (or live match) data to improve performance. Ideally, any user would be using fetch.

Signature:

fetchByKeys(keys: number[], options?: FetchOptions): Promise<Collection<string, Champion>>;

Parameters:

ParameterTypeDescription
keysNumberThe keys of the champions to fetch.
optionsFetchOptionsThe basic fetching options.

Return type: Promise < Collection < String, Champion > >


.fetchByName ()

Fetch a champion by their name (instead of ID, which is very similar but not the same as the name). The search is case-insensitive. The special characters are NOT ignored.

Signature:

fetchByName(name: string, options?: FetchOptions): Promise<Champion | undefined>;

Parameters:

ParameterTypeDescription
nameStringThe name of the champions to fetch.
optionsFetchOptionsThe basic fetching options.

Return type: Promise < Champion | Undefined >


.fetchByNames ()

Fetch and cache champions by their names.

Signature:

fetchByNames(names: string[], options?: FetchOptions): Promise<Collection<string, Champion>>;

Parameters:

ParameterTypeDescription
namesStringThe names of the champions to fetch.
optionsFetchOptionsThe basic fetching options.

Return type: Promise < Collection < String, Champion > >


.fetchRotations ()

Fetch champion rotation data from Champion v3 API.

This is the only method that needs a valid API key in this manager. Needs access to the Champion v3 API.

Signature:

fetchRotations(options?: FetchOptions): Promise<Collection<string, Champion[]>>;

Parameters:

ParameterTypeDescription
optionsFetchOptionsThe basic fetching options.

Return type: Promise < Collection < String, Champion > >