UNPKG

liquipedia-api

Version:
72 lines (71 loc) 3.06 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DotaClient = void 0; const dota_1 = require("../api/dota"); const dota_2 = require("../parser/dota"); const tournaments_1 = require("../types/dota/tournaments"); class DotaClient { constructor(config) { this.api = new dota_1.DotaApi(config); this.parser = new dota_2.DotaParser(); } getPlayers() { return __awaiter(this, void 0, void 0, function* () { throw new Error('TODO: create getPlayers method'); const response = yield this.api.getPlayers(); // return this.parser.parsePlayers(response.parse.text['*']); }); } getTeams() { return __awaiter(this, void 0, void 0, function* () { const response = yield this.api.getTeams(); return this.parser.parseTeams(response.parse.text['*']); }); } getTransfers() { return __awaiter(this, void 0, void 0, function* () { const response = yield this.api.getTransfers(); return this.parser.parseTransfers(response.parse.text['*']); }); } getMatches() { return __awaiter(this, void 0, void 0, function* () { const response = yield this.api.getMatches(); return this.parser.parseMatches(response.parse.text['*']); }); } getHeroes() { return __awaiter(this, void 0, void 0, function* () { const response = yield this.api.getHeroes(); return this.parser.parseHeroes(response.parse.text['*']); }); } getItems() { return __awaiter(this, void 0, void 0, function* () { const response = yield this.api.getItems(); return this.parser.parseItems(response.parse.text['*']); }); } getPatches() { return __awaiter(this, void 0, void 0, function* () { const response = yield this.api.getPatches(); return this.parser.parsePatches(response.parse.text['*']); }); } getTournaments(tournamentType = tournaments_1.TournamentTier.All) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.api.getTournaments(tournamentType); return this.parser.parseTournaments(response.parse.text['*']); }); } } exports.DotaClient = DotaClient;