zhonya
Version:
A simple and typed League of Legends API wrapper for Node.js
33 lines • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FreeWeekAPI = void 0;
const ZhonyaError_1 = require("../errors/ZhonyaError");
const freeweek_service_1 = require("../resources/freeWeek/freeweek.service");
/**
* Class for accessing free champion rotation functionalities
*/
class FreeWeekAPI {
constructor(context) {
this.context = context;
this.freeWeekService = new freeweek_service_1.FreeWeekService(context.config);
}
/**
* Get the free champion rotation for the week
* @returns Free champion rotation data
* @throws {ZhonyaError} - If there's an error with the client or API request
* @remarks **This method requires a valid API key to work**
*/
async get() {
this.context.checkInitialized();
this.context.checkApiKey();
try {
return await this.freeWeekService.getFreeWeekChampions();
}
catch (error) {
const zhonyaError = error;
throw new ZhonyaError_1.ZhonyaError("Error while fetching freeweek", zhonyaError.riotError);
}
}
}
exports.FreeWeekAPI = FreeWeekAPI;
//# sourceMappingURL=freeWeek.js.map