/* 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.36.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'; // @ts-ignore import type { GetAccountApiUsageLevelVolumeProgressResponse } from '../models'; // @ts-ignore import type { GetAccountEndpointCostsResponse } from '../models'; /** * AccountApi - axios parameter creator */ export const AccountApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Endpoint to retrieve the authenticated user\'s Predictions API usage tier and token-bucket limits. Public Predictions tiers include Basic, Advanced, Expert, Premier, Paragon, Prime, and Prestige. * @summary Get Account API Limits * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAccountApiLimits: async (options: RawAxiosRequestConfig = {}): Promise => { 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, }; }, /** * Returns the authenticated user\'s latest cron-computed trading volume progress toward volume-based API usage tiers for the predictions (event_contract) lane. Volume figures are reported as fixed-point contract counts. * @summary Get Account API Usage Level Volume Progress * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAccountApiUsageLevelVolumeProgress: async (options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/account/api_usage_level/volume_progress`; // 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, }; }, /** * Lists API v2 endpoints whose configured token cost differs from the default cost. Endpoints that use the default cost are omitted. * @summary List Non-Default Endpoint Costs * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAccountEndpointCosts: async (options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/account/endpoint_costs`; // 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, }; }, /** * Grants a permanent Advanced API usage-level grant. Currently only the Predictions exchange instance is supported. Criteria: at least 1 of the user\'s last 100 Predictions orders was created via API. Use Get Account API Limits to inspect the resulting usage tier and grants. * @summary Upgrade Account API Usage Level * @param {*} [options] Override http request option. * @throws {RequiredError} */ upgradeAccountApiUsageLevel: async (options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/account/api_usage_level/upgrade`; // 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: 'POST', ...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 authenticated user\'s Predictions API usage tier and token-bucket limits. Public Predictions tiers include Basic, Advanced, Expert, Premier, Paragon, Prime, and Prestige. * @summary Get Account API Limits * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAccountApiLimits(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { 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); }, /** * Returns the authenticated user\'s latest cron-computed trading volume progress toward volume-based API usage tiers for the predictions (event_contract) lane. Volume figures are reported as fixed-point contract counts. * @summary Get Account API Usage Level Volume Progress * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAccountApiUsageLevelVolumeProgress(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getAccountApiUsageLevelVolumeProgress(options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Lists API v2 endpoints whose configured token cost differs from the default cost. Endpoints that use the default cost are omitted. * @summary List Non-Default Endpoint Costs * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAccountEndpointCosts(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getAccountEndpointCosts(options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Grants a permanent Advanced API usage-level grant. Currently only the Predictions exchange instance is supported. Criteria: at least 1 of the user\'s last 100 Predictions orders was created via API. Use Get Account API Limits to inspect the resulting usage tier and grants. * @summary Upgrade Account API Usage Level * @param {*} [options] Override http request option. * @throws {RequiredError} */ async upgradeAccountApiUsageLevel(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.upgradeAccountApiUsageLevel(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 authenticated user\'s Predictions API usage tier and token-bucket limits. Public Predictions tiers include Basic, Advanced, Expert, Premier, Paragon, Prime, and Prestige. * @summary Get Account API Limits * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAccountApiLimits(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getAccountApiLimits(options).then((request) => request(axios, basePath)); }, /** * Returns the authenticated user\'s latest cron-computed trading volume progress toward volume-based API usage tiers for the predictions (event_contract) lane. Volume figures are reported as fixed-point contract counts. * @summary Get Account API Usage Level Volume Progress * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAccountApiUsageLevelVolumeProgress(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getAccountApiUsageLevelVolumeProgress(options).then((request) => request(axios, basePath)); }, /** * Lists API v2 endpoints whose configured token cost differs from the default cost. Endpoints that use the default cost are omitted. * @summary List Non-Default Endpoint Costs * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAccountEndpointCosts(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getAccountEndpointCosts(options).then((request) => request(axios, basePath)); }, /** * Grants a permanent Advanced API usage-level grant. Currently only the Predictions exchange instance is supported. Criteria: at least 1 of the user\'s last 100 Predictions orders was created via API. Use Get Account API Limits to inspect the resulting usage tier and grants. * @summary Upgrade Account API Usage Level * @param {*} [options] Override http request option. * @throws {RequiredError} */ upgradeAccountApiUsageLevel(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.upgradeAccountApiUsageLevel(options).then((request) => request(axios, basePath)); }, }; }; /** * AccountApi - object-oriented interface */ export class AccountApi extends BaseAPI { /** * Endpoint to retrieve the authenticated user\'s Predictions API usage tier and token-bucket limits. Public Predictions tiers include Basic, Advanced, Expert, Premier, Paragon, Prime, and Prestige. * @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)); } /** * Returns the authenticated user\'s latest cron-computed trading volume progress toward volume-based API usage tiers for the predictions (event_contract) lane. Volume figures are reported as fixed-point contract counts. * @summary Get Account API Usage Level Volume Progress * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getAccountApiUsageLevelVolumeProgress(options?: RawAxiosRequestConfig) { return AccountApiFp(this.configuration).getAccountApiUsageLevelVolumeProgress(options).then((request) => request(this.axios, this.basePath)); } /** * Lists API v2 endpoints whose configured token cost differs from the default cost. Endpoints that use the default cost are omitted. * @summary List Non-Default Endpoint Costs * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getAccountEndpointCosts(options?: RawAxiosRequestConfig) { return AccountApiFp(this.configuration).getAccountEndpointCosts(options).then((request) => request(this.axios, this.basePath)); } /** * Grants a permanent Advanced API usage-level grant. Currently only the Predictions exchange instance is supported. Criteria: at least 1 of the user\'s last 100 Predictions orders was created via API. Use Get Account API Limits to inspect the resulting usage tier and grants. * @summary Upgrade Account API Usage Level * @param {*} [options] Override http request option. * @throws {RequiredError} */ public upgradeAccountApiUsageLevel(options?: RawAxiosRequestConfig) { return AccountApiFp(this.configuration).upgradeAccountApiUsageLevel(options).then((request) => request(this.axios, this.basePath)); } }