galeforce-tmp-sea
Version:
A customizable, promise-based, and command-oriented TypeScript library for the Riot Games API.
32 lines • 1.6 kB
JavaScript
;
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.TakesQuery)({}, (0, mixins_1.TakesTier)((0, mixins_1.TakesDivision)((0, mixins_1.TakesSummonerId)((0, mixins_1.TakesRegion)({}, action_1.default)))));
class GetTFTLeagueEntries 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.TFT_LEAGUE.SUMMONER_ID;
}
else if (typeof this.payload.division !== 'undefined' || typeof this.payload.tier !== 'undefined') {
if (this.payload.tier && [riot_api_1.Tier.MASTER, riot_api_1.Tier.GRANDMASTER, riot_api_1.Tier.CHALLENGER].includes(this.payload.tier)) {
throw new Error('[galeforce]: /tft/league/v1/entries does not currently support the apex tiers.');
}
this.payload.endpoint = riot_api_1.ENDPOINTS.TFT_LEAGUE.ENTRIES_BY_RANK;
}
else {
throw new Error('[galeforce]: Not enough parameters provided to select API endpoint.');
}
}
}
exports.default = GetTFTLeagueEntries;
//# sourceMappingURL=entries.js.map