kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
346 lines (345 loc) • 22.1 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.ApiKeysApi = exports.ApiKeysApiFactory = exports.ApiKeysApiFp = exports.ApiKeysApiAxiosParamCreator = 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");
/**
* ApiKeysApi - axios parameter creator
*/
const ApiKeysApiAxiosParamCreator = function (configuration) {
return {
/**
* Endpoint for creating a new API key with a user-provided public key. This endpoint allows users with Premier or Market Maker API usage levels to create API keys by providing their own RSA public key. The platform will use this public key to verify signatures on API requests.
* @summary Create API Key
* @param {CreateApiKeyRequest} createApiKeyRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createApiKey: (createApiKeyRequest_1, ...args_1) => __awaiter(this, [createApiKeyRequest_1, ...args_1], void 0, function* (createApiKeyRequest, options = {}) {
// verify required parameter 'createApiKeyRequest' is not null or undefined
(0, common_1.assertParamExists)('createApiKey', 'createApiKeyRequest', createApiKeyRequest);
const localVarPath = `/api_keys`;
// 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: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication kalshiAccessSignature required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
localVarHeaderParameter['Content-Type'] = 'application/json';
(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);
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createApiKeyRequest, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for deleting an existing API key. This endpoint permanently deletes an API key. Once deleted, the key can no longer be used for authentication. This action cannot be undone.
* @summary Delete API Key
* @param {string} apiKey API key ID to delete
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteApiKey: (apiKey_1, ...args_1) => __awaiter(this, [apiKey_1, ...args_1], void 0, function* (apiKey, options = {}) {
// verify required parameter 'apiKey' is not null or undefined
(0, common_1.assertParamExists)('deleteApiKey', 'apiKey', apiKey);
const localVarPath = `/api_keys/{api_key}`
.replace(`{${"api_key"}}`, encodeURIComponent(String(apiKey)));
// 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: 'DELETE' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication kalshiAccessSignature required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
(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,
};
}),
/**
* Endpoint for generating a new API key with an automatically created key pair. This endpoint generates both a public and private RSA key pair. The public key is stored on the platform, while the private key is returned to the user and must be stored securely. The private key cannot be retrieved again.
* @summary Generate API Key
* @param {GenerateApiKeyRequest} generateApiKeyRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
generateApiKey: (generateApiKeyRequest_1, ...args_1) => __awaiter(this, [generateApiKeyRequest_1, ...args_1], void 0, function* (generateApiKeyRequest, options = {}) {
// verify required parameter 'generateApiKeyRequest' is not null or undefined
(0, common_1.assertParamExists)('generateApiKey', 'generateApiKeyRequest', generateApiKeyRequest);
const localVarPath = `/api_keys/generate`;
// 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: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication kalshiAccessSignature required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
localVarHeaderParameter['Content-Type'] = 'application/json';
(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);
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(generateApiKeyRequest, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for retrieving all API keys associated with the authenticated user. API keys allow programmatic access to the platform without requiring username/password authentication. Each key has a unique identifier and name.
* @summary Get API Keys
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getApiKeys: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
const localVarPath = `/api_keys`;
// 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 = {};
// authentication kalshiAccessSignature required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
(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.ApiKeysApiAxiosParamCreator = ApiKeysApiAxiosParamCreator;
/**
* ApiKeysApi - functional programming interface
*/
const ApiKeysApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.ApiKeysApiAxiosParamCreator)(configuration);
return {
/**
* Endpoint for creating a new API key with a user-provided public key. This endpoint allows users with Premier or Market Maker API usage levels to create API keys by providing their own RSA public key. The platform will use this public key to verify signatures on API requests.
* @summary Create API Key
* @param {CreateApiKeyRequest} createApiKeyRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createApiKey(createApiKeyRequest, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.createApiKey(createApiKeyRequest, 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);
});
},
/**
* Endpoint for deleting an existing API key. This endpoint permanently deletes an API key. Once deleted, the key can no longer be used for authentication. This action cannot be undone.
* @summary Delete API Key
* @param {string} apiKey API key ID to delete
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteApiKey(apiKey, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteApiKey(apiKey, 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);
});
},
/**
* Endpoint for generating a new API key with an automatically created key pair. This endpoint generates both a public and private RSA key pair. The public key is stored on the platform, while the private key is returned to the user and must be stored securely. The private key cannot be retrieved again.
* @summary Generate API Key
* @param {GenerateApiKeyRequest} generateApiKeyRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
generateApiKey(generateApiKeyRequest, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.generateApiKey(generateApiKeyRequest, 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);
});
},
/**
* Endpoint for retrieving all API keys associated with the authenticated user. API keys allow programmatic access to the platform without requiring username/password authentication. Each key has a unique identifier and name.
* @summary Get API Keys
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getApiKeys(options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getApiKeys(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.ApiKeysApiFp = ApiKeysApiFp;
/**
* ApiKeysApi - factory interface
*/
const ApiKeysApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.ApiKeysApiFp)(configuration);
return {
/**
* Endpoint for creating a new API key with a user-provided public key. This endpoint allows users with Premier or Market Maker API usage levels to create API keys by providing their own RSA public key. The platform will use this public key to verify signatures on API requests.
* @summary Create API Key
* @param {CreateApiKeyRequest} createApiKeyRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createApiKey(createApiKeyRequest, options) {
return localVarFp.createApiKey(createApiKeyRequest, options).then((request) => request(axios, basePath));
},
/**
* Endpoint for deleting an existing API key. This endpoint permanently deletes an API key. Once deleted, the key can no longer be used for authentication. This action cannot be undone.
* @summary Delete API Key
* @param {string} apiKey API key ID to delete
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteApiKey(apiKey, options) {
return localVarFp.deleteApiKey(apiKey, options).then((request) => request(axios, basePath));
},
/**
* Endpoint for generating a new API key with an automatically created key pair. This endpoint generates both a public and private RSA key pair. The public key is stored on the platform, while the private key is returned to the user and must be stored securely. The private key cannot be retrieved again.
* @summary Generate API Key
* @param {GenerateApiKeyRequest} generateApiKeyRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
generateApiKey(generateApiKeyRequest, options) {
return localVarFp.generateApiKey(generateApiKeyRequest, options).then((request) => request(axios, basePath));
},
/**
* Endpoint for retrieving all API keys associated with the authenticated user. API keys allow programmatic access to the platform without requiring username/password authentication. Each key has a unique identifier and name.
* @summary Get API Keys
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getApiKeys(options) {
return localVarFp.getApiKeys(options).then((request) => request(axios, basePath));
},
};
};
exports.ApiKeysApiFactory = ApiKeysApiFactory;
/**
* ApiKeysApi - object-oriented interface
*/
class ApiKeysApi extends base_1.BaseAPI {
/**
* Endpoint for creating a new API key with a user-provided public key. This endpoint allows users with Premier or Market Maker API usage levels to create API keys by providing their own RSA public key. The platform will use this public key to verify signatures on API requests.
* @summary Create API Key
* @param {CreateApiKeyRequest} createApiKeyRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createApiKey(createApiKeyRequest, options) {
return (0, exports.ApiKeysApiFp)(this.configuration).createApiKey(createApiKeyRequest, options).then((request) => request(this.axios, this.basePath));
}
/**
* Endpoint for deleting an existing API key. This endpoint permanently deletes an API key. Once deleted, the key can no longer be used for authentication. This action cannot be undone.
* @summary Delete API Key
* @param {string} apiKey API key ID to delete
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteApiKey(apiKey, options) {
return (0, exports.ApiKeysApiFp)(this.configuration).deleteApiKey(apiKey, options).then((request) => request(this.axios, this.basePath));
}
/**
* Endpoint for generating a new API key with an automatically created key pair. This endpoint generates both a public and private RSA key pair. The public key is stored on the platform, while the private key is returned to the user and must be stored securely. The private key cannot be retrieved again.
* @summary Generate API Key
* @param {GenerateApiKeyRequest} generateApiKeyRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
generateApiKey(generateApiKeyRequest, options) {
return (0, exports.ApiKeysApiFp)(this.configuration).generateApiKey(generateApiKeyRequest, options).then((request) => request(this.axios, this.basePath));
}
/**
* Endpoint for retrieving all API keys associated with the authenticated user. API keys allow programmatic access to the platform without requiring username/password authentication. Each key has a unique identifier and name.
* @summary Get API Keys
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getApiKeys(options) {
return (0, exports.ApiKeysApiFp)(this.configuration).getApiKeys(options).then((request) => request(this.axios, this.basePath));
}
}
exports.ApiKeysApi = ApiKeysApi;