@balldontlie/sdk
Version:
Official TypeScript/JavaScript SDK for the balldontlie API
133 lines (132 loc) • 4.7 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.NBAClient = void 0;
const client_1 = require("./client");
class NBAClient extends client_1.BaseClient {
getTeams(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/teams`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getTeam(id) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/teams/${id}`);
});
}
getPlayers(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/players`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getPlayer(id) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/players/${id}`);
});
}
getActivePlayers(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/players/active`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getGames(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/games`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getGame(id) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/games/${id}`);
});
}
getStats(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/stats`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getSeasonAverages(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/season_averages`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getStandings(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/standings`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getLiveBoxScores() {
return __awaiter(this, void 0, void 0, function* () {
return this.request("/nba/v1/box_scores/live");
});
}
getBoxScores(date) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/box_scores`, {
method: "GET",
params: this.buildQueryParams({ date }),
});
});
}
getPlayerInjuries(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/player_injuries`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getLeaders(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/leaders?`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getOdds(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/odds?`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
getAdvancedStats(params) {
return __awaiter(this, void 0, void 0, function* () {
return this.request(`/nba/v1/stats/advanced`, {
method: "GET",
params: this.buildQueryParams(params),
});
});
}
}
exports.NBAClient = NBAClient;