UNPKG

kalshi-typescript

Version:
370 lines (336 loc) 23.1 kB
/* tslint:disable */ /* eslint-disable */ /** * Kalshi Trade API Manual Endpoints * Manually defined OpenAPI spec for endpoints being migrated to spec-first approach * * The version of the OpenAPI document: 3.11.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; // URLSearchParams not necessarily used // @ts-ignore import { URL, URLSearchParams } from 'url'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import type { GetGameStatsResponse } from '../models'; // @ts-ignore import type { GetLiveDataResponse } from '../models'; // @ts-ignore import type { GetLiveDatasResponse } from '../models'; /** * LiveDataApi - axios parameter creator */ export const LiveDataApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Get play-by-play game statistics for a specific milestone. Supported sports: Pro Football, College Football, Pro Basketball, College Men\'s Basketball, College Women\'s Basketball, WNBA, Soccer, Pro Hockey, and Pro Baseball. Returns null for unsupported milestone types or milestones without a Sportradar ID. * @summary Get Game Stats * @param {string} milestoneId Milestone ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getGameStats: async (milestoneId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'milestoneId' is not null or undefined assertParamExists('getGameStats', 'milestoneId', milestoneId) const localVarPath = `/live_data/milestone/{milestone_id}/game_stats` .replace(`{${"milestone_id"}}`, encodeURIComponent(String(milestoneId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get live data for a specific milestone. This is the legacy endpoint that requires a type path parameter. Prefer using `/live_data/milestone/{milestone_id}` instead. * @summary Get Live Data (with type) * @param {string} type Type of live data * @param {string} milestoneId Milestone ID * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLiveData: async (type: string, milestoneId: string, includePlayerStats?: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'type' is not null or undefined assertParamExists('getLiveData', 'type', type) // verify required parameter 'milestoneId' is not null or undefined assertParamExists('getLiveData', 'milestoneId', milestoneId) const localVarPath = `/live_data/{type}/milestone/{milestone_id}` .replace(`{${"type"}}`, encodeURIComponent(String(type))) .replace(`{${"milestone_id"}}`, encodeURIComponent(String(milestoneId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (includePlayerStats !== undefined) { localVarQueryParameter['include_player_stats'] = includePlayerStats; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get live data for a specific milestone. * @summary Get Live Data * @param {string} milestoneId Milestone ID * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLiveDataByMilestone: async (milestoneId: string, includePlayerStats?: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'milestoneId' is not null or undefined assertParamExists('getLiveDataByMilestone', 'milestoneId', milestoneId) const localVarPath = `/live_data/milestone/{milestone_id}` .replace(`{${"milestone_id"}}`, encodeURIComponent(String(milestoneId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (includePlayerStats !== undefined) { localVarQueryParameter['include_player_stats'] = includePlayerStats; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get live data for multiple milestones * @summary Get Multiple Live Data * @param {Array<string>} milestoneIds Array of milestone IDs * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLiveDatas: async (milestoneIds: Array<string>, includePlayerStats?: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'milestoneIds' is not null or undefined assertParamExists('getLiveDatas', 'milestoneIds', milestoneIds) const localVarPath = `/live_data/batch`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (milestoneIds) { localVarQueryParameter['milestone_ids'] = milestoneIds; } if (includePlayerStats !== undefined) { localVarQueryParameter['include_player_stats'] = includePlayerStats; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * LiveDataApi - functional programming interface */ export const LiveDataApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = LiveDataApiAxiosParamCreator(configuration) return { /** * Get play-by-play game statistics for a specific milestone. Supported sports: Pro Football, College Football, Pro Basketball, College Men\'s Basketball, College Women\'s Basketball, WNBA, Soccer, Pro Hockey, and Pro Baseball. Returns null for unsupported milestone types or milestones without a Sportradar ID. * @summary Get Game Stats * @param {string} milestoneId Milestone ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getGameStats(milestoneId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetGameStatsResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getGameStats(milestoneId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Get live data for a specific milestone. This is the legacy endpoint that requires a type path parameter. Prefer using `/live_data/milestone/{milestone_id}` instead. * @summary Get Live Data (with type) * @param {string} type Type of live data * @param {string} milestoneId Milestone ID * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getLiveData(type: string, milestoneId: string, includePlayerStats?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetLiveDataResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getLiveData(type, milestoneId, includePlayerStats, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Get live data for a specific milestone. * @summary Get Live Data * @param {string} milestoneId Milestone ID * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getLiveDataByMilestone(milestoneId: string, includePlayerStats?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetLiveDataResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getLiveDataByMilestone(milestoneId, includePlayerStats, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Get live data for multiple milestones * @summary Get Multiple Live Data * @param {Array<string>} milestoneIds Array of milestone IDs * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getLiveDatas(milestoneIds: Array<string>, includePlayerStats?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetLiveDatasResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getLiveDatas(milestoneIds, includePlayerStats, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * LiveDataApi - factory interface */ export const LiveDataApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = LiveDataApiFp(configuration) return { /** * Get play-by-play game statistics for a specific milestone. Supported sports: Pro Football, College Football, Pro Basketball, College Men\'s Basketball, College Women\'s Basketball, WNBA, Soccer, Pro Hockey, and Pro Baseball. Returns null for unsupported milestone types or milestones without a Sportradar ID. * @summary Get Game Stats * @param {string} milestoneId Milestone ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getGameStats(milestoneId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetGameStatsResponse> { return localVarFp.getGameStats(milestoneId, options).then((request) => request(axios, basePath)); }, /** * Get live data for a specific milestone. This is the legacy endpoint that requires a type path parameter. Prefer using `/live_data/milestone/{milestone_id}` instead. * @summary Get Live Data (with type) * @param {string} type Type of live data * @param {string} milestoneId Milestone ID * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLiveData(type: string, milestoneId: string, includePlayerStats?: boolean, options?: RawAxiosRequestConfig): AxiosPromise<GetLiveDataResponse> { return localVarFp.getLiveData(type, milestoneId, includePlayerStats, options).then((request) => request(axios, basePath)); }, /** * Get live data for a specific milestone. * @summary Get Live Data * @param {string} milestoneId Milestone ID * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLiveDataByMilestone(milestoneId: string, includePlayerStats?: boolean, options?: RawAxiosRequestConfig): AxiosPromise<GetLiveDataResponse> { return localVarFp.getLiveDataByMilestone(milestoneId, includePlayerStats, options).then((request) => request(axios, basePath)); }, /** * Get live data for multiple milestones * @summary Get Multiple Live Data * @param {Array<string>} milestoneIds Array of milestone IDs * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLiveDatas(milestoneIds: Array<string>, includePlayerStats?: boolean, options?: RawAxiosRequestConfig): AxiosPromise<GetLiveDatasResponse> { return localVarFp.getLiveDatas(milestoneIds, includePlayerStats, options).then((request) => request(axios, basePath)); }, }; }; /** * LiveDataApi - object-oriented interface */ export class LiveDataApi extends BaseAPI { /** * Get play-by-play game statistics for a specific milestone. Supported sports: Pro Football, College Football, Pro Basketball, College Men\'s Basketball, College Women\'s Basketball, WNBA, Soccer, Pro Hockey, and Pro Baseball. Returns null for unsupported milestone types or milestones without a Sportradar ID. * @summary Get Game Stats * @param {string} milestoneId Milestone ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getGameStats(milestoneId: string, options?: RawAxiosRequestConfig) { return LiveDataApiFp(this.configuration).getGameStats(milestoneId, options).then((request) => request(this.axios, this.basePath)); } /** * Get live data for a specific milestone. This is the legacy endpoint that requires a type path parameter. Prefer using `/live_data/milestone/{milestone_id}` instead. * @summary Get Live Data (with type) * @param {string} type Type of live data * @param {string} milestoneId Milestone ID * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getLiveData(type: string, milestoneId: string, includePlayerStats?: boolean, options?: RawAxiosRequestConfig) { return LiveDataApiFp(this.configuration).getLiveData(type, milestoneId, includePlayerStats, options).then((request) => request(this.axios, this.basePath)); } /** * Get live data for a specific milestone. * @summary Get Live Data * @param {string} milestoneId Milestone ID * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getLiveDataByMilestone(milestoneId: string, includePlayerStats?: boolean, options?: RawAxiosRequestConfig) { return LiveDataApiFp(this.configuration).getLiveDataByMilestone(milestoneId, includePlayerStats, options).then((request) => request(this.axios, this.basePath)); } /** * Get live data for multiple milestones * @summary Get Multiple Live Data * @param {Array<string>} milestoneIds Array of milestone IDs * @param {boolean} [includePlayerStats] When true, includes player-level statistics in the live data response. Supported for Pro Football, Pro Basketball, and College Men\&#39;s Basketball milestones that have player ID mappings configured. Has no effect for other sports or milestones without player mappings. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getLiveDatas(milestoneIds: Array<string>, includePlayerStats?: boolean, options?: RawAxiosRequestConfig) { return LiveDataApiFp(this.configuration).getLiveDatas(milestoneIds, includePlayerStats, options).then((request) => request(this.axios, this.basePath)); } }