UNPKG

kalshi-typescript

Version:
218 lines (217 loc) 12.2 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. */ 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'; /** * StructuredTargetsApi - axios parameter creator */ export const StructuredTargetsApiAxiosParamCreator = function (configuration) { return { /** * Endpoint for getting data about a specific structured target by its ID. * @summary Get Structured Target * @param {string} structuredTargetId Structured target ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStructuredTarget: (structuredTargetId_1, ...args_1) => __awaiter(this, [structuredTargetId_1, ...args_1], void 0, function* (structuredTargetId, options = {}) { // verify required parameter 'structuredTargetId' is not null or undefined assertParamExists('getStructuredTarget', 'structuredTargetId', structuredTargetId); const localVarPath = `/structured_targets/{structured_target_id}` .replace(`{${"structured_target_id"}}`, encodeURIComponent(String(structuredTargetId))); // 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, }; }), /** * Page size (min: 1, max: 2000) * @summary Get Structured Targets * @param {Array<string>} [ids] Filter by specific structured target IDs. Pass multiple IDs by repeating the parameter (e.g. &#x60;?ids&#x3D;uuid1&amp;ids&#x3D;uuid2&#x60;). * @param {string} [type] Filter by structured target type * @param {string} [competition] Filter by competition. Matches against the league, conference, division, or tour in the structured target details. * @param {number} [pageSize] Number of items per page (min 1, max 2000, default 100) * @param {string} [cursor] Pagination cursor * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStructuredTargets: (ids_1, type_1, competition_1, pageSize_1, cursor_1, ...args_1) => __awaiter(this, [ids_1, type_1, competition_1, pageSize_1, cursor_1, ...args_1], void 0, function* (ids, type, competition, pageSize, cursor, options = {}) { const localVarPath = `/structured_targets`; // 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 (ids) { localVarQueryParameter['ids'] = ids; } if (type !== undefined) { localVarQueryParameter['type'] = type; } if (competition !== undefined) { localVarQueryParameter['competition'] = competition; } if (pageSize !== undefined) { localVarQueryParameter['page_size'] = pageSize; } if (cursor !== undefined) { localVarQueryParameter['cursor'] = cursor; } 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, }; }), }; }; /** * StructuredTargetsApi - functional programming interface */ export const StructuredTargetsApiFp = function (configuration) { const localVarAxiosParamCreator = StructuredTargetsApiAxiosParamCreator(configuration); return { /** * Endpoint for getting data about a specific structured target by its ID. * @summary Get Structured Target * @param {string} structuredTargetId Structured target ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStructuredTarget(structuredTargetId, options) { return __awaiter(this, void 0, void 0, function* () { var _a; const localVarAxiosArgs = yield localVarAxiosParamCreator.getStructuredTarget(structuredTargetId, 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); }); }, /** * Page size (min: 1, max: 2000) * @summary Get Structured Targets * @param {Array<string>} [ids] Filter by specific structured target IDs. Pass multiple IDs by repeating the parameter (e.g. &#x60;?ids&#x3D;uuid1&amp;ids&#x3D;uuid2&#x60;). * @param {string} [type] Filter by structured target type * @param {string} [competition] Filter by competition. Matches against the league, conference, division, or tour in the structured target details. * @param {number} [pageSize] Number of items per page (min 1, max 2000, default 100) * @param {string} [cursor] Pagination cursor * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStructuredTargets(ids, type, competition, pageSize, cursor, options) { return __awaiter(this, void 0, void 0, function* () { var _a; const localVarAxiosArgs = yield localVarAxiosParamCreator.getStructuredTargets(ids, type, competition, pageSize, cursor, 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); }); }, }; }; /** * StructuredTargetsApi - factory interface */ export const StructuredTargetsApiFactory = function (configuration, basePath, axios) { const localVarFp = StructuredTargetsApiFp(configuration); return { /** * Endpoint for getting data about a specific structured target by its ID. * @summary Get Structured Target * @param {string} structuredTargetId Structured target ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStructuredTarget(structuredTargetId, options) { return localVarFp.getStructuredTarget(structuredTargetId, options).then((request) => request(axios, basePath)); }, /** * Page size (min: 1, max: 2000) * @summary Get Structured Targets * @param {Array<string>} [ids] Filter by specific structured target IDs. Pass multiple IDs by repeating the parameter (e.g. &#x60;?ids&#x3D;uuid1&amp;ids&#x3D;uuid2&#x60;). * @param {string} [type] Filter by structured target type * @param {string} [competition] Filter by competition. Matches against the league, conference, division, or tour in the structured target details. * @param {number} [pageSize] Number of items per page (min 1, max 2000, default 100) * @param {string} [cursor] Pagination cursor * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStructuredTargets(ids, type, competition, pageSize, cursor, options) { return localVarFp.getStructuredTargets(ids, type, competition, pageSize, cursor, options).then((request) => request(axios, basePath)); }, }; }; /** * StructuredTargetsApi - object-oriented interface */ export class StructuredTargetsApi extends BaseAPI { /** * Endpoint for getting data about a specific structured target by its ID. * @summary Get Structured Target * @param {string} structuredTargetId Structured target ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStructuredTarget(structuredTargetId, options) { return StructuredTargetsApiFp(this.configuration).getStructuredTarget(structuredTargetId, options).then((request) => request(this.axios, this.basePath)); } /** * Page size (min: 1, max: 2000) * @summary Get Structured Targets * @param {Array<string>} [ids] Filter by specific structured target IDs. Pass multiple IDs by repeating the parameter (e.g. &#x60;?ids&#x3D;uuid1&amp;ids&#x3D;uuid2&#x60;). * @param {string} [type] Filter by structured target type * @param {string} [competition] Filter by competition. Matches against the league, conference, division, or tour in the structured target details. * @param {number} [pageSize] Number of items per page (min 1, max 2000, default 100) * @param {string} [cursor] Pagination cursor * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStructuredTargets(ids, type, competition, pageSize, cursor, options) { return StructuredTargetsApiFp(this.configuration).getStructuredTargets(ids, type, competition, pageSize, cursor, options).then((request) => request(this.axios, this.basePath)); } }