kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
350 lines (349 loc) • 23.3 kB
JavaScript
/* 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.
*/
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());
});
};
import globalAxios from 'axios';
// URLSearchParams not necessarily used
// @ts-ignore
import { URL } from 'url';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setSearchParams, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, BaseAPI } from '../base';
/**
* LiveDataApi - axios parameter creator
*/
export const LiveDataApiAxiosParamCreator = function (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_1, ...args_1) => __awaiter(this, [milestoneId_1, ...args_1], void 0, function* (milestoneId, options = {}) {
// 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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, 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\'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_1, milestoneId_1, includePlayerStats_1, ...args_1) => __awaiter(this, [type_1, milestoneId_1, includePlayerStats_1, ...args_1], void 0, function* (type, milestoneId, includePlayerStats, options = {}) {
// 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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (includePlayerStats !== undefined) {
localVarQueryParameter['include_player_stats'] = includePlayerStats;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, 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\'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_1, includePlayerStats_1, ...args_1) => __awaiter(this, [milestoneId_1, includePlayerStats_1, ...args_1], void 0, function* (milestoneId, includePlayerStats, options = {}) {
// 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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (includePlayerStats !== undefined) {
localVarQueryParameter['include_player_stats'] = includePlayerStats;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, 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\'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_1, includePlayerStats_1, ...args_1) => __awaiter(this, [milestoneIds_1, includePlayerStats_1, ...args_1], void 0, function* (milestoneIds, includePlayerStats, options = {}) {
// 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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
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 = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
/**
* LiveDataApi - functional programming interface
*/
export const LiveDataApiFp = function (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}
*/
getGameStats(milestoneId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getGameStats(milestoneId, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = 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\'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, milestoneId, includePlayerStats, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getLiveData(type, milestoneId, includePlayerStats, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = 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\'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, includePlayerStats, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getLiveDataByMilestone(milestoneId, includePlayerStats, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = 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\'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, includePlayerStats, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getLiveDatas(milestoneIds, includePlayerStats, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
};
};
/**
* LiveDataApi - factory interface
*/
export const LiveDataApiFactory = function (configuration, basePath, axios) {
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, options) {
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\'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, milestoneId, includePlayerStats, options) {
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\'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, includePlayerStats, options) {
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\'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, includePlayerStats, options) {
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}
*/
getGameStats(milestoneId, options) {
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\'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, milestoneId, includePlayerStats, options) {
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\'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, includePlayerStats, options) {
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\'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, includePlayerStats, options) {
return LiveDataApiFp(this.configuration).getLiveDatas(milestoneIds, includePlayerStats, options).then((request) => request(this.axios, this.basePath));
}
}