UNPKG

sportradar-api-client

Version:

Node and NestJS wrappers for Sportradar feeds

1,005 lines (865 loc) 81.1 kB
/** * Sportradar MLB API * Sportradar is the Official Provider of real-time MLB statistics. The data collection comes direct from the MLB operations teams on-venue. This provides lightning speed and the highest-quality stats available to power your baseball experiences. All MLB games – including Spring Training – feature full coverage. The MLB API is consistent in structure, format, and behavior with our other League Specific APIs. Our primary feeds return schedules, standings, team/player data, and real-time scores. Our other MLB feeds provide a host of complimentary statistics and information, including: * Injuries * Pitch metrics * League leaders * Venues * Depth charts * Season statistics * Seasonal splits Real-time customers are also offered three delivery Push Feeds to enhance speed. An extra package containing MLB Statcast data is also available. This package includes: * **Premium Deeper Pitch Data** featuring spin rate, vertical and horizontal movement and more specific pitch types * **Premium Hit Data** including exit velocity, launch angle, spin rate and project home run distance * **Premium Play Level Statcast** Data containing deeper information on fielding and base-running performance The easiest way to get started with the API is to click the fork button to fork this collection to your own workspace and use Postman to send requests. # Overview 1. You need a valid API Key to send requests to the API endpoints. You can get your free trial key by registering an account and creating an application from our [Developer Portal](https://developer.sportradar.com/). 2. Once you have your sport specific key, replace the value `{Your API Key}` with your API key and click the save icon (or click the Meatballs Menu and select \"Save\") 3. By default, responses to every request are sent in JSON. If you prefer XML, you can change the variable by clicking the \"Variables\" tab and replacing the Current Value for format to xml. 4. Select an endpoint from the MLB v7 menu on the left, then click \"Send\" on the resulting screen. 5. The API calls will respond with appropriate [HTTP response codes](https://developer.sportradar.com/docs/read/Home#http-response-codes) for all requests. Within Postman Client, when a response is received, the status code is highlighted and is accompanied by a help text that indicates the possible meaning of the response code. A 200 OK indicates all went well, while 4XX or 5XX response codes indicate an error from the requesting client or our API servers respectively. 6. Data for the requested endpoint is displayed in the Body section below. # Other Resources The [API Map](https://developer.sportradar.com/docs/read/baseball/MLB_v7#mlb-api-map) on our Developer Portal illustrates how to obtain the parameters you will need to access the API. The [Statistics Summary](https://developer.sportradar.com/files/Sportradar_MLB_v7_Statistics_Summary.pdf) provides a high-level overview of all the data points provided within the whole API, giving you an “at a glance” view of the data we offer. The [Documentation](https://developer.sportradar.com/files/Sportradar_MLB_v7_Statistics_Feeds.pdf) provides a list of endpoints for the API with basic descriptions. When applicable, we include information on the Coverage Levels provided for the API. This document also includes descriptions of each data point and information about where each data point can be found within the API. [Frequently Asked Questions](https://developer.sportradar.com/docs/read/baseball/MLB_v7#frequently-asked-questions) about the API can be found on the Developer Portal and in the Documentation mentioned above. The [Change Log](https://developer.sportradar.com/files/MLB_API_v7_Change_Log.pdf) provides a list of changes and updates to this version of the API since the initial release of the API version. If you need further information, contact our support team: Email: [support@sportradar.com](mailto:support@sportradar.com) * * The version of the OpenAPI document: 7 * * * 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 { DefaultSportradarMlbApiServiceInterface } from './default.serviceInterface'; @Injectable() export class DefaultSportradarMlbApiService implements DefaultSportradarMlbApiServiceInterface { protected basePath = 'https://api.sportradar.com/mlb/production/v7'; public defaultHeaders: Record<string, string> = {}; public configuration = new Configuration(); constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) { this.configuration = configuration || this.configuration; //console.debug('DefaultSportradarMlbApiService(): 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 Boxscore * Inning-by-inning scoring breakdown, top-level runs, hits and errors by team, as well as details on run-scoring events for all games on a given MLB defined day. * @param locale (Required) Locale used for translations * @param year (Required) Year in 4 digit format * @param month (Required) Locale used for translations * @param day (Required) Locale used for translations * @param format * @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 dailyBoxscore(locale: string, year: number, month: number, day: number, format: string,): Observable<AxiosResponse<any>>; public dailyBoxscore(locale: string, year: number, month: number, day: number, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling dailyBoxscore.'); } if (year === null || year === undefined) { throw new Error('Required parameter year was null or undefined when calling dailyBoxscore.'); } if (month === null || month === undefined) { throw new Error('Required parameter month was null or undefined when calling dailyBoxscore.'); } if (day === null || day === undefined) { throw new Error('Required parameter day was null or undefined when calling dailyBoxscore.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling dailyBoxscore.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/games/${encodeURIComponent(String(year))}/${encodeURIComponent(String(month))}/${encodeURIComponent(String(day))}/boxscore.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Daily Change Log * Provides IDs and timestamps for teams, players, game statistics, schedules, and standings that have been modified on a given date. To receive the data updates, use these unique IDs to pull relevant API feeds. * @param locale (Required) Locale used for translations * @param year (Required) Year in 4 digit format * @param month (Required) Month in 2 digit format * @param day (Required) Day in 2 digit format * @param format * @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 dailyChangeLog(locale: string, year: number, month: number, day: number, format: string,): Observable<AxiosResponse<any>>; public dailyChangeLog(locale: string, year: number, month: number, day: number, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling dailyChangeLog.'); } if (year === null || year === undefined) { throw new Error('Required parameter year was null or undefined when calling dailyChangeLog.'); } if (month === null || month === undefined) { throw new Error('Required parameter month was null or undefined when calling dailyChangeLog.'); } if (day === null || day === undefined) { throw new Error('Required parameter day was null or undefined when calling dailyChangeLog.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling dailyChangeLog.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/league/${encodeURIComponent(String(year))}/${encodeURIComponent(String(month))}/${encodeURIComponent(String(day))}/changes.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Daily Schedule * The date, time and location for all games on a given MLB defined day. * @param locale (Required) Locale used for translations * @param year (Required) Year in 4 digit format * @param month (Required) Month in 2 digit format * @param day (Required) Day in 2 digit format * @param format * @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 dailySchedule(locale: string, year: number, month: number, day: number, format: string,): Observable<AxiosResponse<any>>; public dailySchedule(locale: string, year: number, month: number, day: number, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling dailySchedule.'); } if (year === null || year === undefined) { throw new Error('Required parameter year was null or undefined when calling dailySchedule.'); } if (month === null || month === undefined) { throw new Error('Required parameter month was null or undefined when calling dailySchedule.'); } if (day === null || day === undefined) { throw new Error('Required parameter day was null or undefined when calling dailySchedule.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling dailySchedule.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/games/${encodeURIComponent(String(year))}/${encodeURIComponent(String(month))}/${encodeURIComponent(String(day))}/schedule.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Daily Summary * Team lineups as well as team and player statistics for all games on a given MLB defined day. * @param locale (Required) Locale used for translations * @param year (Required) Year in 4 digit format * @param month (Required) Month in 2 digit format * @param day (Required) Day in 2 digit format * @param format * @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 dailySummary(locale: string, year: number, month: number, day: number, format: string,): Observable<AxiosResponse<any>>; public dailySummary(locale: string, year: number, month: number, day: number, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling dailySummary.'); } if (year === null || year === undefined) { throw new Error('Required parameter year was null or undefined when calling dailySummary.'); } if (month === null || month === undefined) { throw new Error('Required parameter month was null or undefined when calling dailySummary.'); } if (day === null || day === undefined) { throw new Error('Required parameter day was null or undefined when calling dailySummary.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling dailySummary.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/games/${encodeURIComponent(String(year))}/${encodeURIComponent(String(month))}/${encodeURIComponent(String(day))}/summary.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Daily Transactions * Information concerning all transactions taking place on a given MLB defined day. * @param locale (Required) Locale used for translations * @param year (Required) Year in 4 digit format * @param month (Required) Month in 2 digit format * @param day (Required) Day in 2 digit format * @param format * @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 dailyTransactions(locale: string, year: number, month: number, day: number, format: string,): Observable<AxiosResponse<any>>; public dailyTransactions(locale: string, year: number, month: number, day: number, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling dailyTransactions.'); } if (year === null || year === undefined) { throw new Error('Required parameter year was null or undefined when calling dailyTransactions.'); } if (month === null || month === undefined) { throw new Error('Required parameter month was null or undefined when calling dailyTransactions.'); } if (day === null || day === undefined) { throw new Error('Required parameter day was null or undefined when calling dailyTransactions.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling dailyTransactions.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/league/${encodeURIComponent(String(year))}/${encodeURIComponent(String(month))}/${encodeURIComponent(String(day))}/transactions.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Game Boxscore * Inning-by-inning scoring breakdown, hits and errors by team, win/loss results, as well as details on run-scoring events for a given game. * @param locale (Required) Locale used for translations * @param game_id (Required) ID of a game * @param format * @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 gameBoxscore(locale: string, game_id: string, format: string,): Observable<AxiosResponse<any>>; public gameBoxscore(locale: string, game_id: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling gameBoxscore.'); } if (game_id === null || game_id === undefined) { throw new Error('Required parameter game_id was null or undefined when calling gameBoxscore.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling gameBoxscore.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/games/${encodeURIComponent(String(game_id))}/boxscore.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Game Extended Summary * Inning-by-inning scoring, key game events, lineups, and team and player statistics for the given game and season-to-date. * @param locale (Required) Locale used for translations * @param game_id (Required) ID of a game * @param format * @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 gameExtendedSummary(locale: string, game_id: string, format: string,): Observable<AxiosResponse<any>>; public gameExtendedSummary(locale: string, game_id: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling gameExtendedSummary.'); } if (game_id === null || game_id === undefined) { throw new Error('Required parameter game_id was null or undefined when calling gameExtendedSummary.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling gameExtendedSummary.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/games/${encodeURIComponent(String(game_id))}/extended_summary.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Game Summary * Team lineups as well as team and player statistics for a given game. * @param locale (Required) Locale used for translations * @param game_id (Required) ID of a game * @param format * @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 gameSummary(locale: string, game_id: string, format: string,): Observable<AxiosResponse<any>>; public gameSummary(locale: string, game_id: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling gameSummary.'); } if (game_id === null || game_id === undefined) { throw new Error('Required parameter game_id was null or undefined when calling gameSummary.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling gameSummary.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/games/${encodeURIComponent(String(game_id))}/summary.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Glossary * Full text descriptions for pitch ids, player status ids, outcome ids, and game status ids. * @param locale (Required) Locale used for translations * @param format * @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 glossary(locale: string, format: string,): Observable<AxiosResponse<any>>; public glossary(locale: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling glossary.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling glossary.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/league/glossary.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Injuries * Information concerning all current injuries across the league. * @param locale (Required) Locale used for translations * @param format * @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(locale: string, format: string,): Observable<AxiosResponse<any>>; public injuries(locale: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling injuries.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling injuries.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/league/injuries.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * League Depth Chart * Current depth chart positions for every MLB team. * @param locale (Required) Locale used for translations * @param format * @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 leagueDepthChart(locale: string, format: string,): Observable<AxiosResponse<any>>; public leagueDepthChart(locale: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling leagueDepthChart.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling leagueDepthChart.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/league/depth_charts.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * League Hierarchy * Provides top-level information for each team, including league and division distinction, and venue information. * @param locale (Required) Locale used for translations * @param format * @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 leagueHierarchy(locale: string, format: string,): Observable<AxiosResponse<any>>; public leagueHierarchy(locale: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling leagueHierarchy.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling leagueHierarchy.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/league/hierarchy.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * League Leaders * AL, NL, and MLB leader information for various hitting and pitching statistics. * @param locale (Required) Locale used for translations * @param year (Required) Year in 4 digit format * @param season_type (Required) Season type as Regular (REG) * @param format * @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 leagueLeaders(locale: string, year: number, season_type: string, format: string,): Observable<AxiosResponse<any>>; public leagueLeaders(locale: string, year: number, season_type: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling leagueLeaders.'); } if (year === null || year === undefined) { throw new Error('Required parameter year was null or undefined when calling leagueLeaders.'); } if (season_type === null || season_type === undefined) { throw new Error('Required parameter season_type was null or undefined when calling leagueLeaders.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling leagueLeaders.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/seasons/${encodeURIComponent(String(year))}/${encodeURIComponent(String(season_type))}/leaders/statistics.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * League Schedule * Complete schedule information for a given season, including venue and broadcast info. * @param locale (Required) Locale used for translations * @param year (Required) Year in 4 digit format * @param season_type (Required) Season type as Preseason (PRE), Regular (REG), Postseason (PST), or All-Star Game (AST) * @param format * @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 leagueSchedule(locale: string, year: number, season_type: string, format: string,): Observable<AxiosResponse<any>>; public leagueSchedule(locale: string, year: number, season_type: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling leagueSchedule.'); } if (year === null || year === undefined) { throw new Error('Required parameter year was null or undefined when calling leagueSchedule.'); } if (season_type === null || season_type === undefined) { throw new Error('Required parameter season_type was null or undefined when calling leagueSchedule.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling leagueSchedule.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/games/${encodeURIComponent(String(year))}/${encodeURIComponent(String(season_type))}/schedule.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Play by Play * Detailed, real-time information on every pitch and game event. * @param locale (Required) Locale used for translations * @param game_id (Required) ID of a game * @param format * @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 playByPlay(locale: string, game_id: string, format: string,): Observable<AxiosResponse<any>>; public playByPlay(locale: string, game_id: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling playByPlay.'); } if (game_id === null || game_id === undefined) { throw new Error('Required parameter game_id was null or undefined when calling playByPlay.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling playByPlay.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/games/${encodeURIComponent(String(game_id))}/pbp.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Player Profile * Player biographical information, including current and historical seasonal statistics and splits. * @param locale (Required) Locale used for translations * @param player_id (Required) ID of a player * @param format * @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 playerProfile(locale: string, player_id: string, format: string,): Observable<AxiosResponse<any>>; public playerProfile(locale: string, player_id: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling playerProfile.'); } if (player_id === null || player_id === undefined) { throw new Error('Required parameter player_id was null or undefined when calling playerProfile.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling playerProfile.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/players/${encodeURIComponent(String(player_id))}/profile.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Rankings * League and division rank for each team, including post season clinching status. * @param locale (Required) Locale used for translations * @param year (Required) Year in 4 digit format * @param season_type (Required) Season type as Regular (REG) * @param format * @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 rankings(locale: string, year: number, season_type: string, format: string,): Observable<AxiosResponse<any>>; public rankings(locale: string, year: number, season_type: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling rankings.'); } if (year === null || year === undefined) { throw new Error('Required parameter year was null or undefined when calling rankings.'); } if (season_type === null || season_type === undefined) { throw new Error('Required parameter season_type was null or undefined when calling rankings.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling rankings.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const 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}/${encodeURIComponent(String(locale))}/seasons/${encodeURIComponent(String(year))}/${encodeURIComponent(String(season_type))}/rankings.${encodeURIComponent(String(format))}`, { withCredentials: this.configuration.withCredentials, params: queryParameters, headers: headers } ); } /** * Seasonal Pitch Metrics * Detailed metrics on pitch type, velocity, and results for a given pitcher by season. * @param locale (Required) Locale used for translations * @param player_id (Required) ID of a player * @param format * @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 seasonalPitchMetrics(locale: string, player_id: string, format: string,): Observable<AxiosResponse<any>>; public seasonalPitchMetrics(locale: string, player_id: string, format: string,): Observable<any> { if (locale === null || locale === undefined) { throw new Error('Required parameter locale was null or undefined when calling seasonalPitchMetrics.'); } if (player_id === null || player_id === undefined) { throw new Error('Required parameter player_id was null or undefined when calling seasonalPitchMetrics.'); } if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling seasonalPitchMetrics.'); } const headers = { ...this.defaultHeaders }; // authentication (apikeyAuth) required const queryParameters = new URLSearchParams(); if (this.configuration.apiKeys["api_key"]) { queryParameters.append('api_key', this.configuration.apiKeys["api_key"]); } // to determine the Accept header const httpHe