UNPKG

samira

Version:

A TypeScript library for League of Legends API calls

92 lines 2.7 kB
import { Either } from './types/either'; import { ApiError } from './utils/httpClient'; import { DataDragonConfig, ItemAsset, RuneAsset, SummonerSpellAsset } from './types'; import { type ChampionResume } from './types/dataDragon/championResume'; export declare class DataDragon { private client; private config; private baseUrl; private version; private language; private isVersionFetched; private initialized; private cache; constructor(config?: DataDragonConfig); /** * Initialize the Data Dragon service * This will fetch all the data and cache it */ init(): Promise<void>; /** * Ensure the service is ready with the correct version */ private ensureVersionReady; /** * Fetch and set the latest Data Dragon version */ private fetchAndSetLatestVersion; /** * Get the latest Data Dragon version */ getLatestVersion(): Promise<Either<ApiError, string[]>>; /** * Get all champions data */ getChampions(version?: string): Promise<Either<ApiError, Record<string, ChampionResume>>>; /** * Get specific champion data */ getChampionResumeById(championId: number): ChampionResume; /** * Get all items data */ getItems(version?: string): Promise<Either<ApiError, Record<string, ItemAsset>>>; /** * Get specific item data */ getItemById(itemId: number): ItemAsset; /** * Get runes data */ getRunes(version?: string): Promise<Either<ApiError, RuneAsset[]>>; getRuneTreeById(runeTreeId: number): RuneAsset; /** * Get summoner spells data */ getSummonerSpells(version?: string): Promise<Either<ApiError, Record<string, SummonerSpellAsset>>>; getSummonerSpellById(spellId: number): SummonerSpellAsset; /** * Get asset URL (full URL or path based on config) */ getAssetUrl(assetPath: string): string; /** * Get champion image URL */ getChampionImageUrl(championId: number): string; /** * Get item image URL */ getItemImageUrl(itemId: string): string; /** * Get rune image URL */ getRuneImageUrl(runeTree: number, runeId: number): string; getRuneTreeImageUrl(runeTree: number): string; /** * Get summoner spell image URL */ getSummonerSpellImageUrl(spellId: number): string; /** * Get profile icon URL */ getProfileIconUrl(iconId: number): string; /** * Update configuration */ updateConfig(config: Partial<DataDragonConfig>): void; /** * Get current configuration */ getConfig(): DataDragonConfig; } //# sourceMappingURL=dataDragon.d.ts.map