kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
225 lines (224 loc) • 12.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.StructuredTargetsApi = exports.StructuredTargetsApiFactory = exports.StructuredTargetsApiFp = exports.StructuredTargetsApiAxiosParamCreator = 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");
/**
* StructuredTargetsApi - axios parameter creator
*/
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
(0, common_1.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_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,
};
}),
/**
* 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. `?ids=uuid1&ids=uuid2`).
* @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_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 (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;
}
(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.StructuredTargetsApiAxiosParamCreator = StructuredTargetsApiAxiosParamCreator;
/**
* StructuredTargetsApi - functional programming interface
*/
const StructuredTargetsApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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. `?ids=uuid1&ids=uuid2`).
* @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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
};
};
exports.StructuredTargetsApiFp = StructuredTargetsApiFp;
/**
* StructuredTargetsApi - factory interface
*/
const StructuredTargetsApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.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. `?ids=uuid1&ids=uuid2`).
* @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));
},
};
};
exports.StructuredTargetsApiFactory = StructuredTargetsApiFactory;
/**
* StructuredTargetsApi - object-oriented interface
*/
class StructuredTargetsApi extends base_1.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 (0, exports.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. `?ids=uuid1&ids=uuid2`).
* @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 (0, exports.StructuredTargetsApiFp)(this.configuration).getStructuredTargets(ids, type, competition, pageSize, cursor, options).then((request) => request(this.axios, this.basePath));
}
}
exports.StructuredTargetsApi = StructuredTargetsApi;