rotowire-api-client
Version:
Node and NestJS wrappers for Rotowire feeds
184 lines • 8.4 kB
JavaScript
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultRotowireMlbApiService = void 0;
const common_1 = require("@nestjs/common");
const axios_1 = require("@nestjs/axios");
const configuration_1 = require("../configuration");
let DefaultRotowireMlbApiService = class DefaultRotowireMlbApiService {
constructor(httpClient, configuration) {
this.httpClient = httpClient;
this.basePath = 'https://api.rotowire.com/Baseball/MLB';
this.defaultHeaders = {};
this.configuration = new configuration_1.Configuration();
this.configuration = configuration || this.configuration;
this.basePath = (configuration === null || configuration === void 0 ? void 0 : configuration.basePath) || this.basePath;
}
canConsumeForm(consumes) {
const form = 'multipart/form-data';
return consumes.includes(form);
}
dailyProjections(format, date) {
if (format === null || format === undefined) {
throw new Error('Required parameter format was null or undefined when calling dailyProjections.');
}
let queryParameters = new URLSearchParams();
if (date !== undefined && date !== null) {
queryParameters.append('date', date);
}
if (format !== undefined && format !== null) {
queryParameters.append('format', format);
}
let headers = { ...this.defaultHeaders };
if (this.configuration.apiKeys["key"]) {
queryParameters.append('key', this.configuration.apiKeys["key"]);
}
let httpHeaderAccepts = [
'application/json'
];
const httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers['Accept'] = httpHeaderAcceptSelected;
}
const consumes = [];
return this.httpClient.get(`${this.basePath}/DailyProjections.php`, {
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers
});
}
expectedLineups(format, date) {
if (format === null || format === undefined) {
throw new Error('Required parameter format was null or undefined when calling expectedLineups.');
}
let queryParameters = new URLSearchParams();
if (date !== undefined && date !== null) {
queryParameters.append('date', date);
}
if (format !== undefined && format !== null) {
queryParameters.append('format', format);
}
let headers = { ...this.defaultHeaders };
if (this.configuration.apiKeys["key"]) {
queryParameters.append('key', this.configuration.apiKeys["key"]);
}
let httpHeaderAccepts = [
'application/json'
];
const httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers['Accept'] = httpHeaderAcceptSelected;
}
const consumes = [];
return this.httpClient.get(`${this.basePath}/ExpectedLineups.php`, {
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers
});
}
injuries(format) {
if (format === null || format === undefined) {
throw new Error('Required parameter format was null or undefined when calling injuries.');
}
let queryParameters = new URLSearchParams();
if (format !== undefined && format !== null) {
queryParameters.append('format', format);
}
let headers = { ...this.defaultHeaders };
if (this.configuration.apiKeys["key"]) {
queryParameters.append('key', this.configuration.apiKeys["key"]);
}
let httpHeaderAccepts = [
'application/json'
];
const httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers['Accept'] = httpHeaderAcceptSelected;
}
const consumes = [];
return this.httpClient.get(`${this.basePath}/Injuries.php`, {
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers
});
}
newsInjuries(format, date) {
if (format === null || format === undefined) {
throw new Error('Required parameter format was null or undefined when calling newsInjuries.');
}
let queryParameters = new URLSearchParams();
if (date !== undefined && date !== null) {
queryParameters.append('date', date);
}
if (format !== undefined && format !== null) {
queryParameters.append('format', format);
}
let headers = { ...this.defaultHeaders };
if (this.configuration.apiKeys["key"]) {
queryParameters.append('key', this.configuration.apiKeys["key"]);
}
let httpHeaderAccepts = [
'application/json'
];
const httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers['Accept'] = httpHeaderAcceptSelected;
}
const consumes = [];
return this.httpClient.get(`${this.basePath}/News/Injuries.php`, {
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers
});
}
projectedStarters(format, date, spring_training) {
if (format === null || format === undefined) {
throw new Error('Required parameter format was null or undefined when calling projectedStarters.');
}
let queryParameters = new URLSearchParams();
if (date !== undefined && date !== null) {
queryParameters.append('date', date);
}
if (format !== undefined && format !== null) {
queryParameters.append('format', format);
}
if (spring_training !== undefined && spring_training !== null) {
queryParameters.append('spring_training', spring_training);
}
let headers = { ...this.defaultHeaders };
if (this.configuration.apiKeys["key"]) {
queryParameters.append('key', this.configuration.apiKeys["key"]);
}
let httpHeaderAccepts = [
'application/json'
];
const httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers['Accept'] = httpHeaderAcceptSelected;
}
const consumes = [];
return this.httpClient.get(`${this.basePath}/ProjectedStarters.php`, {
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers
});
}
};
exports.DefaultRotowireMlbApiService = DefaultRotowireMlbApiService;
exports.DefaultRotowireMlbApiService = DefaultRotowireMlbApiService = __decorate([
(0, common_1.Injectable)(),
__param(1, (0, common_1.Optional)()),
__metadata("design:paramtypes", [axios_1.HttpService, configuration_1.Configuration])
], DefaultRotowireMlbApiService);
//# sourceMappingURL=default.service.js.map