liquipedia-api
Version: 
Node.js Liquipedia API
72 lines (71 loc) • 3.15 kB
JavaScript
;
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.PubgMobileClient = void 0;
const pubgmobile_1 = require("../api/pubgmobile");
const pubgmobile_2 = require("../parser/pubgmobile");
const tournaments_1 = require("../types/pubgmobile/tournaments");
class PubgMobileClient {
    constructor(config) {
        this.api = new pubgmobile_1.PubgMobileApi(config);
        this.parser = new pubgmobile_2.PubgMobileParser();
    }
    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['*']);
        });
    }
    getMaps() {
        return __awaiter(this, void 0, void 0, function* () {
            const response = yield this.api.getMaps();
            return this.parser.parseMaps(response.parse.text['*']);
        });
    }
    getWeapons() {
        return __awaiter(this, void 0, void 0, function* () {
            const response = yield this.api.getWeapons();
            return this.parser.parseWeapons(response.parse.text['*']);
        });
    }
    getVehicles() {
        return __awaiter(this, void 0, void 0, function* () {
            const response = yield this.api.getVehicles();
            return this.parser.parseVehicles(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.PubgMobileClient = PubgMobileClient;