UNPKG

galeforce-tmp-sea

Version:

A customizable, promise-based, and command-oriented TypeScript library for the Riot Games API.

35 lines 1.78 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const action_1 = __importDefault(require("../../action")); const riot_api_1 = require("../../../../riot-api"); const mixins_1 = require("../../mixins"); const BaseAction = (0, mixins_1.TakesQueue)({}, (0, mixins_1.TakesTier)((0, mixins_1.TakesDivision)((0, mixins_1.TakesSummonerId)((0, mixins_1.TakesQuery)({}, (0, mixins_1.TakesRegion)({}, action_1.default)))))); class GetLeagueEntries extends BaseAction { constructor(submodules) { super(submodules); this.payload.type = 'lol'; this.payload.method = 'GET'; } inferEndpoint() { if (typeof this.payload.summonerId !== 'undefined') { this.payload.endpoint = riot_api_1.ENDPOINTS.LEAGUE.SUMMONER_ID; } else if (typeof this.payload.queue !== 'undefined' || typeof this.payload.tier !== 'undefined' || typeof this.payload.division !== 'undefined') { if (typeof this.payload.tier !== 'undefined' && [riot_api_1.Tier.MASTER, riot_api_1.Tier.GRANDMASTER, riot_api_1.Tier.CHALLENGER].includes(this.payload.tier)) { // set to experimental endpoint for support this.payload.endpoint = riot_api_1.ENDPOINTS.LEAGUE.ENTRIES_BY_RANK_EXP; } else { this.payload.endpoint = riot_api_1.ENDPOINTS.LEAGUE.ENTRIES_BY_RANK; // set to default endpoint } } else { throw new Error('[galeforce]: Not enough parameters provided to select API endpoint.'); } } } exports.default = GetLeagueEntries; //# sourceMappingURL=entries.js.map