UNPKG

zhonya

Version:

A simple and typed League of Legends API wrapper for Node.js

34 lines 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChampionAPI = void 0; const ZhonyaError_1 = require("../errors/ZhonyaError"); const champion_service_1 = require("../resources/champion/champion.service"); /** * Class for accessing champion-related functionalities */ class ChampionAPI { constructor(context) { this.context = context; this.championService = new champion_service_1.ChampionService(context.config); } /** * Get all champions * @returns Data for all champions * @throws {ZhonyaError} - If the client is not initialized * @remarks **This method does not require an API key to work** */ async getAll() { this.context.checkInitialized(); try { return await this.championService.getAllChampions({ language: this.context.config.language, }); } catch (error) { const zhonyaError = error; throw new ZhonyaError_1.ZhonyaError(`Error while fetching all champions`, zhonyaError.riotError); } } } exports.ChampionAPI = ChampionAPI; //# sourceMappingURL=champion.js.map