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:
Parameter | Type | Description |
---|---|---|
client | Client | The 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:
Parameter | Type | Description |
---|---|---|
id | String | The ID of the champion whose data needs to be fetched. |
options | FetchOptions | The 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:
Parameter | Type | Description |
---|---|---|
options | FetchOptions | The 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:
Parameter | Type | Description |
---|---|---|
key | Number | The key of the champions to fetch. |
options | FetchOptions | The 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:
Parameter | Type | Description |
---|---|---|
keys | Number | The keys of the champions to fetch. |
options | FetchOptions | The 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:
Parameter | Type | Description |
---|---|---|
name | String | The name of the champions to fetch. |
options | FetchOptions | The 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:
Parameter | Type | Description |
---|---|---|
names | String | The names of the champions to fetch. |
options | FetchOptions | The 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:
Parameter | Type | Description |
---|---|---|
options | FetchOptions | The basic fetching options. |
Return type: Promise < Collection < String, Champion > >