UNPKG

rotowire-api-client

Version:

Node and NestJS wrappers for Rotowire feeds

300 lines (256 loc) 11.5 kB
/** * Rotowire MLB API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@nestjs/common'; import { HttpService } from '@nestjs/axios'; import { AxiosResponse } from 'axios'; import { Observable } from 'rxjs'; import { Configuration } from '../configuration'; import { DefaultRotowireMlbApiServiceInterface } from './default.serviceInterface'; @Injectable() export class DefaultRotowireMlbApiService implements DefaultRotowireMlbApiServiceInterface { protected basePath = 'https://api.rotowire.com/Baseball/MLB'; public defaultHeaders: Record<string, string> = {}; public configuration = new Configuration(); constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) { this.configuration = configuration || this.configuration; this.basePath = configuration?.basePath || this.basePath; } /** * @param consumes string[] mime-types * @return true: consumes contains 'multipart/form-data', false: otherwise */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; return consumes.includes(form); } /** * Daily Projections * * @param format Output Format - json or yaml (default) * @param date Date \&quot;YYYY-MM-DD\&quot; * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public dailyProjections(format: string, date?: string,): Observable<AxiosResponse<any>>; public dailyProjections(format: string, date?: string,): Observable<any> { 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', <any>date); } if (format !== undefined && format !== null) { queryParameters.append('format', <any>format); } let headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required if (this.configuration.apiKeys["key"]) { queryParameters.append('key', this.configuration.apiKeys["key"]); } // to determine the Accept header let httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { headers['Accept'] = httpHeaderAcceptSelected; } // to determine the Content-Type header const consumes: string[] = [ ]; return this.httpClient.get<any>(`${this.basePath}/DailyProjections.php`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers } ); } /** * Expected Lineups * * @param format Output Format - json or yaml (default) * @param date Date \&quot;YYYY-MM-DD\&quot; * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public expectedLineups(format: string, date?: string,): Observable<AxiosResponse<any>>; public expectedLineups(format: string, date?: string,): Observable<any> { 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', <any>date); } if (format !== undefined && format !== null) { queryParameters.append('format', <any>format); } let headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required if (this.configuration.apiKeys["key"]) { queryParameters.append('key', this.configuration.apiKeys["key"]); } // to determine the Accept header let httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { headers['Accept'] = httpHeaderAcceptSelected; } // to determine the Content-Type header const consumes: string[] = [ ]; return this.httpClient.get<any>(`${this.basePath}/ExpectedLineups.php`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers } ); } /** * Injuries * * @param format Output Format - json or yaml (default) * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public injuries(format: string,): Observable<AxiosResponse<any>>; public injuries(format: string,): Observable<any> { 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', <any>format); } let headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required if (this.configuration.apiKeys["key"]) { queryParameters.append('key', this.configuration.apiKeys["key"]); } // to determine the Accept header let httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { headers['Accept'] = httpHeaderAcceptSelected; } // to determine the Content-Type header const consumes: string[] = [ ]; return this.httpClient.get<any>(`${this.basePath}/Injuries.php`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers } ); } /** * News Injuries * * @param format Output Format - json or yaml (default) * @param date Date \&quot;YYYY-MM-DD\&quot; * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public newsInjuries(format: string, date?: string,): Observable<AxiosResponse<any>>; public newsInjuries(format: string, date?: string,): Observable<any> { 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', <any>date); } if (format !== undefined && format !== null) { queryParameters.append('format', <any>format); } let headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required if (this.configuration.apiKeys["key"]) { queryParameters.append('key', this.configuration.apiKeys["key"]); } // to determine the Accept header let httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { headers['Accept'] = httpHeaderAcceptSelected; } // to determine the Content-Type header const consumes: string[] = [ ]; return this.httpClient.get<any>(`${this.basePath}/News/Injuries.php`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers } ); } /** * Projected Starters * * @param format Output Format - json or yaml (default) * @param date Date \&quot;YYYY-MM-DD\&quot; * @param spring_training Flag to show spring training games * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public projectedStarters(format: string, date?: string, spring_training?: number,): Observable<AxiosResponse<any>>; public projectedStarters(format: string, date?: string, spring_training?: number,): Observable<any> { 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', <any>date); } if (format !== undefined && format !== null) { queryParameters.append('format', <any>format); } if (spring_training !== undefined && spring_training !== null) { queryParameters.append('spring_training', <any>spring_training); } let headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required if (this.configuration.apiKeys["key"]) { queryParameters.append('key', this.configuration.apiKeys["key"]); } // to determine the Accept header let httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { headers['Accept'] = httpHeaderAcceptSelected; } // to determine the Content-Type header const consumes: string[] = [ ]; return this.httpClient.get<any>(`${this.basePath}/ProjectedStarters.php`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers } ); } }