kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
257 lines (256 loc) • 15.8 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.MilestoneApi = exports.MilestoneApiFactory = exports.MilestoneApiFp = exports.MilestoneApiAxiosParamCreator = 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");
/**
* MilestoneApi - axios parameter creator
*/
const MilestoneApiAxiosParamCreator = function (configuration) {
return {
/**
* Endpoint for getting data about a specific milestone by its ID.
* @summary Get Milestone
* @param {string} milestoneId Milestone ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMilestone: (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)('getMilestone', 'milestoneId', milestoneId);
const localVarPath = `/milestones/{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 = {};
(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,
};
}),
/**
* Minimum start date to filter milestones. Format: RFC3339 timestamp
* @summary Get Milestones
* @param {number} limit Number of milestones to return per page
* @param {string} [minimumStartDate] Minimum start date to filter milestones. Format RFC3339 timestamp
* @param {string} [category] Filter by milestone category. E.g. Sports, Elections, Esports, Crypto.
* @param {string} [competition] Filter by competition. E.g. Pro Football, Pro Basketball (M), Pro Baseball, Pro Hockey, College Football.
* @param {string} [sourceId] Filter by source id
* @param {string} [type] Filter by milestone type. E.g. football_game, basketball_game, soccer_tournament_multi_leg, baseball_game, hockey_match, political_race.
* @param {string} [relatedEventTicker] Filter by related event ticker
* @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results
* @param {number} [minUpdatedTs] Filter milestones with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMilestones: (limit_1, minimumStartDate_1, category_1, competition_1, sourceId_1, type_1, relatedEventTicker_1, cursor_1, minUpdatedTs_1, ...args_1) => __awaiter(this, [limit_1, minimumStartDate_1, category_1, competition_1, sourceId_1, type_1, relatedEventTicker_1, cursor_1, minUpdatedTs_1, ...args_1], void 0, function* (limit, minimumStartDate, category, competition, sourceId, type, relatedEventTicker, cursor, minUpdatedTs, options = {}) {
// verify required parameter 'limit' is not null or undefined
(0, common_1.assertParamExists)('getMilestones', 'limit', limit);
const localVarPath = `/milestones`;
// 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 (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (minimumStartDate !== undefined) {
localVarQueryParameter['minimum_start_date'] = (minimumStartDate instanceof Date) ?
minimumStartDate.toISOString() :
minimumStartDate;
}
if (category !== undefined) {
localVarQueryParameter['category'] = category;
}
if (competition !== undefined) {
localVarQueryParameter['competition'] = competition;
}
if (sourceId !== undefined) {
localVarQueryParameter['source_id'] = sourceId;
}
if (type !== undefined) {
localVarQueryParameter['type'] = type;
}
if (relatedEventTicker !== undefined) {
localVarQueryParameter['related_event_ticker'] = relatedEventTicker;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (minUpdatedTs !== undefined) {
localVarQueryParameter['min_updated_ts'] = minUpdatedTs;
}
(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.MilestoneApiAxiosParamCreator = MilestoneApiAxiosParamCreator;
/**
* MilestoneApi - functional programming interface
*/
const MilestoneApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.MilestoneApiAxiosParamCreator)(configuration);
return {
/**
* Endpoint for getting data about a specific milestone by its ID.
* @summary Get Milestone
* @param {string} milestoneId Milestone ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMilestone(milestoneId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getMilestone(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);
});
},
/**
* Minimum start date to filter milestones. Format: RFC3339 timestamp
* @summary Get Milestones
* @param {number} limit Number of milestones to return per page
* @param {string} [minimumStartDate] Minimum start date to filter milestones. Format RFC3339 timestamp
* @param {string} [category] Filter by milestone category. E.g. Sports, Elections, Esports, Crypto.
* @param {string} [competition] Filter by competition. E.g. Pro Football, Pro Basketball (M), Pro Baseball, Pro Hockey, College Football.
* @param {string} [sourceId] Filter by source id
* @param {string} [type] Filter by milestone type. E.g. football_game, basketball_game, soccer_tournament_multi_leg, baseball_game, hockey_match, political_race.
* @param {string} [relatedEventTicker] Filter by related event ticker
* @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results
* @param {number} [minUpdatedTs] Filter milestones with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMilestones(limit, minimumStartDate, category, competition, sourceId, type, relatedEventTicker, cursor, minUpdatedTs, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getMilestones(limit, minimumStartDate, category, competition, sourceId, type, relatedEventTicker, cursor, minUpdatedTs, 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.MilestoneApiFp = MilestoneApiFp;
/**
* MilestoneApi - factory interface
*/
const MilestoneApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.MilestoneApiFp)(configuration);
return {
/**
* Endpoint for getting data about a specific milestone by its ID.
* @summary Get Milestone
* @param {string} milestoneId Milestone ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMilestone(milestoneId, options) {
return localVarFp.getMilestone(milestoneId, options).then((request) => request(axios, basePath));
},
/**
* Minimum start date to filter milestones. Format: RFC3339 timestamp
* @summary Get Milestones
* @param {number} limit Number of milestones to return per page
* @param {string} [minimumStartDate] Minimum start date to filter milestones. Format RFC3339 timestamp
* @param {string} [category] Filter by milestone category. E.g. Sports, Elections, Esports, Crypto.
* @param {string} [competition] Filter by competition. E.g. Pro Football, Pro Basketball (M), Pro Baseball, Pro Hockey, College Football.
* @param {string} [sourceId] Filter by source id
* @param {string} [type] Filter by milestone type. E.g. football_game, basketball_game, soccer_tournament_multi_leg, baseball_game, hockey_match, political_race.
* @param {string} [relatedEventTicker] Filter by related event ticker
* @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results
* @param {number} [minUpdatedTs] Filter milestones with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMilestones(limit, minimumStartDate, category, competition, sourceId, type, relatedEventTicker, cursor, minUpdatedTs, options) {
return localVarFp.getMilestones(limit, minimumStartDate, category, competition, sourceId, type, relatedEventTicker, cursor, minUpdatedTs, options).then((request) => request(axios, basePath));
},
};
};
exports.MilestoneApiFactory = MilestoneApiFactory;
/**
* MilestoneApi - object-oriented interface
*/
class MilestoneApi extends base_1.BaseAPI {
/**
* Endpoint for getting data about a specific milestone by its ID.
* @summary Get Milestone
* @param {string} milestoneId Milestone ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMilestone(milestoneId, options) {
return (0, exports.MilestoneApiFp)(this.configuration).getMilestone(milestoneId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Minimum start date to filter milestones. Format: RFC3339 timestamp
* @summary Get Milestones
* @param {number} limit Number of milestones to return per page
* @param {string} [minimumStartDate] Minimum start date to filter milestones. Format RFC3339 timestamp
* @param {string} [category] Filter by milestone category. E.g. Sports, Elections, Esports, Crypto.
* @param {string} [competition] Filter by competition. E.g. Pro Football, Pro Basketball (M), Pro Baseball, Pro Hockey, College Football.
* @param {string} [sourceId] Filter by source id
* @param {string} [type] Filter by milestone type. E.g. football_game, basketball_game, soccer_tournament_multi_leg, baseball_game, hockey_match, political_race.
* @param {string} [relatedEventTicker] Filter by related event ticker
* @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results
* @param {number} [minUpdatedTs] Filter milestones with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMilestones(limit, minimumStartDate, category, competition, sourceId, type, relatedEventTicker, cursor, minUpdatedTs, options) {
return (0, exports.MilestoneApiFp)(this.configuration).getMilestones(limit, minimumStartDate, category, competition, sourceId, type, relatedEventTicker, cursor, minUpdatedTs, options).then((request) => request(this.axios, this.basePath));
}
}
exports.MilestoneApi = MilestoneApi;