kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
357 lines (356 loc) • 24 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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiveDataApi = exports.LiveDataApiFactory = exports.LiveDataApiFp = exports.LiveDataApiAxiosParamCreator = void 0;
const axios_1 = require("axios");
// URLSearchParams not necessarily used
// @ts-ignore
const url_1 = require("url");
// Some imports not used depending on template conditions
// @ts-ignore
const common_1 = require("../common");
// @ts-ignore
const base_1 = require("../base");
/**
* LiveDataApi - axios parameter creator
*/
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
(0, common_1.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_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.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
(0, common_1.assertParamExists)('getLiveData', 'type', type);
// verify required parameter 'milestoneId' is not null or undefined
(0, common_1.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_1.URL(localVarPath, common_1.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;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.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
(0, common_1.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_1.URL(localVarPath, common_1.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;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.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
(0, common_1.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_1.URL(localVarPath, common_1.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;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
exports.LiveDataApiAxiosParamCreator = LiveDataApiAxiosParamCreator;
/**
* LiveDataApi - functional programming interface
*/
const LiveDataApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
};
};
exports.LiveDataApiFp = LiveDataApiFp;
/**
* LiveDataApi - factory interface
*/
const LiveDataApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.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));
},
};
};
exports.LiveDataApiFactory = LiveDataApiFactory;
/**
* LiveDataApi - object-oriented interface
*/
class LiveDataApi extends base_1.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 (0, exports.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 (0, exports.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 (0, exports.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 (0, exports.LiveDataApiFp)(this.configuration).getLiveDatas(milestoneIds, includePlayerStats, options).then((request) => request(this.axios, this.basePath));
}
}
exports.LiveDataApi = LiveDataApi;