kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
130 lines (115 loc) • 5.49 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 { GetAccountApiLimitsResponse } from '../models';
/**
* AccountApi - axios parameter creator
*/
export const AccountApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Endpoint to retrieve the API tier limits associated with the authenticated user.
* @summary Get Account API Limits
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAccountApiLimits: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/account/limits`;
// 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;
// authentication kalshiAccessSignature required
await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration)
// authentication kalshiAccessKey required
await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration)
// authentication kalshiAccessTimestamp required
await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* AccountApi - functional programming interface
*/
export const AccountApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = AccountApiAxiosParamCreator(configuration)
return {
/**
* Endpoint to retrieve the API tier limits associated with the authenticated user.
* @summary Get Account API Limits
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getAccountApiLimits(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetAccountApiLimitsResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getAccountApiLimits(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath: string | undefined = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* AccountApi - factory interface
*/
export const AccountApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = AccountApiFp(configuration)
return {
/**
* Endpoint to retrieve the API tier limits associated with the authenticated user.
* @summary Get Account API Limits
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAccountApiLimits(options?: RawAxiosRequestConfig): AxiosPromise<GetAccountApiLimitsResponse> {
return localVarFp.getAccountApiLimits(options).then((request) => request(axios, basePath));
},
};
};
/**
* AccountApi - object-oriented interface
*/
export class AccountApi extends BaseAPI {
/**
* Endpoint to retrieve the API tier limits associated with the authenticated user.
* @summary Get Account API Limits
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public getAccountApiLimits(options?: RawAxiosRequestConfig) {
return AccountApiFp(this.configuration).getAccountApiLimits(options).then((request) => request(this.axios, this.basePath));
}
}