kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
231 lines (208 loc) • 12.1 kB
text/typescript
/* 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.
*/
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// URLSearchParams not necessarily used
// @ts-ignore
import { URL, URLSearchParams } from 'url';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError } from '../base';
// @ts-ignore
import type { GetStructuredTargetResponse } from '../models';
// @ts-ignore
import type { GetStructuredTargetsResponse } from '../models';
/**
* StructuredTargetsApi - axios parameter creator
*/
export const StructuredTargetsApiAxiosParamCreator = function (configuration?: 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: async (structuredTargetId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// 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 = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...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. `?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: async (ids?: Array<string>, type?: string, competition?: string, pageSize?: number, cursor?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
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 = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
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 = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* StructuredTargetsApi - functional programming interface
*/
export const StructuredTargetsApiFp = function(configuration?: 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}
*/
async getStructuredTarget(structuredTargetId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetStructuredTargetResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getStructuredTarget(structuredTargetId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath: string | undefined = 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. `?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}
*/
async getStructuredTargets(ids?: Array<string>, type?: string, competition?: string, pageSize?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetStructuredTargetsResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getStructuredTargets(ids, type, competition, pageSize, cursor, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath: string | undefined = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* StructuredTargetsApi - factory interface
*/
export const StructuredTargetsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
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: string, options?: RawAxiosRequestConfig): AxiosPromise<GetStructuredTargetResponse> {
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?: Array<string>, type?: string, competition?: string, pageSize?: number, cursor?: string, options?: RawAxiosRequestConfig): AxiosPromise<GetStructuredTargetsResponse> {
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}
*/
public getStructuredTarget(structuredTargetId: string, options?: RawAxiosRequestConfig) {
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. `?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}
*/
public getStructuredTargets(ids?: Array<string>, type?: string, competition?: string, pageSize?: number, cursor?: string, options?: RawAxiosRequestConfig) {
return StructuredTargetsApiFp(this.configuration).getStructuredTargets(ids, type, competition, pageSize, cursor, options).then((request) => request(this.axios, this.basePath));
}
}