kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
94 lines (88 loc) • 2.49 kB
text/typescript
/**
* 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.
*/
/* tslint:disable */
/* eslint-disable */
export interface ConfigurationParameters {
apiKey?: string;
privateKeyPath?: string;
privateKeyPem?: string;
basePath?: string;
serverIndex?: number;
baseOptions?: any;
formDataCtor?: new () => any;
}
export class Configuration {
/**
* Kalshi API Key ID
*
* @type {string}
* @memberof Configuration
*/
apiKey?: string;
/**
* Path to RSA private key PEM file
*
* @type {string}
* @memberof Configuration
*/
privateKeyPath?: string;
/**
* RSA private key PEM string
*
* @type {string}
* @memberof Configuration
*/
privateKeyPem?: string;
/**
* override base path
*
* @type {string}
* @memberof Configuration
*/
basePath?: string;
/**
* override server index
*/
serverIndex?: number;
/**
* base options for axios calls
*/
baseOptions?: any;
/**
* The FormData constructor that will be used to create multipart form data
* requests.
*/
formDataCtor?: new () => any;
constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey;
this.privateKeyPath = param.privateKeyPath;
this.privateKeyPem = param.privateKeyPem;
this.basePath = param.basePath;
this.serverIndex = param.serverIndex;
this.baseOptions = param.baseOptions;
this.formDataCtor = param.formDataCtor;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}