@balldontlie/sdk
Version:
Official TypeScript/JavaScript SDK for the balldontlie API
109 lines (108 loc) • 4.05 kB
JavaScript
"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.EPLClient = void 0;
const client_1 = require("./client");
class EPLClient extends client_1.BaseClient {
getGames(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request("/epl/v1/games", {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getGameLineups(id) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/epl/v1/games/${id}/lineups`);
});
}
getGameGoals(id) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/epl/v1/games/${id}/goals`);
});
}
getGameTeamStats(id) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/epl/v1/games/${id}/team_stats`);
});
}
getGamePlayerStats(id) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/epl/v1/games/${id}/player_stats`);
});
}
getPlayers(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request("/epl/v1/players", {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getPlayerSeasonStats(id, params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/epl/v1/players/${id}/season_stats`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getPlayerStatsLeaders(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request("/epl/v1/player_stats/leaders", {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getTeamStatsLeaders(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request("/epl/v1/team_stats/leaders", {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getStandings(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request("/epl/v1/standings", {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getTeams(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request("/epl/v1/teams", {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getTeamPlayers(id, params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/epl/v1/teams/${id}/players`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getTeamSeasonStats(id, params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/epl/v1/teams/${id}/season_stats`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
}
exports.EPLClient = EPLClient;