/* tslint:disable */ /* eslint-disable */ /** * Credify API doc version 1 * API documentations version 1. * * The version of the OpenAPI document: 1.0.0-oas3 * Contact: dev@credify.one * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; import { Configuration } from '../configuration'; // 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, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import { CommonResponse } from '../model'; // @ts-ignore import { LockEntityRequest } from '../model'; // @ts-ignore import { PrivateKeyResponse } from '../model'; // @ts-ignore import { PublicKeyResponse } from '../model'; /** * CommonApi - axios parameter creator * @export */ export const CommonApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * This fetches an encrypted private keys and corresponding public keys. * @summary Key pairs * @param {*} [options] Override http request option. * @throws {RequiredError} */ getKeyPairs: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/v1/entity/key`; // 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 bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This returns public key of signing and encryption. * @summary Gets public key * @param {string} [entityId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPublicKey: async (entityId?: string, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/v1/entity/public-key`; // 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 bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) if (entityId !== undefined) { localVarQueryParameter['entity_id'] = entityId; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This lock an entity permanently, or temporarily to a specific time. * @summary Lock an entity * @param {string} entityId Entity ID * @param {LockEntityRequest} [lockEntityRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ lockEntity: async (entityId: string, lockEntityRequest?: LockEntityRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'entityId' is not null or undefined assertParamExists('lockEntity', 'entityId', entityId) const localVarPath = `/v1/entity/{entity_id}/lock` .replace(`{${"entity_id"}}`, encodeURIComponent(String(entityId))); // 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 bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = lockEntityRequest return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This unlock an entity from both permanent or temporary locking status. * @summary Unlock an entity * @param {string} entityId Entity ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ unlockEntity: async (entityId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'entityId' is not null or undefined assertParamExists('unlockEntity', 'entityId', entityId) const localVarPath = `/v1/entity/{entity_id}/unlock` .replace(`{${"entity_id"}}`, encodeURIComponent(String(entityId))); // 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 bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * CommonApi - functional programming interface * @export */ export const CommonApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = CommonApiAxiosParamCreator(configuration) return { /** * This fetches an encrypted private keys and corresponding public keys. * @summary Key pairs * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getKeyPairs(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getKeyPairs(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This returns public key of signing and encryption. * @summary Gets public key * @param {string} [entityId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getPublicKey(entityId?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPublicKey(entityId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This lock an entity permanently, or temporarily to a specific time. * @summary Lock an entity * @param {string} entityId Entity ID * @param {LockEntityRequest} [lockEntityRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async lockEntity(entityId: string, lockEntityRequest?: LockEntityRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.lockEntity(entityId, lockEntityRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This unlock an entity from both permanent or temporary locking status. * @summary Unlock an entity * @param {string} entityId Entity ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async unlockEntity(entityId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.unlockEntity(entityId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * CommonApi - factory interface * @export */ export const CommonApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = CommonApiFp(configuration) return { /** * This fetches an encrypted private keys and corresponding public keys. * @summary Key pairs * @param {*} [options] Override http request option. * @throws {RequiredError} */ getKeyPairs(options?: any): AxiosPromise { return localVarFp.getKeyPairs(options).then((request) => request(axios, basePath)); }, /** * This returns public key of signing and encryption. * @summary Gets public key * @param {string} [entityId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPublicKey(entityId?: string, options?: any): AxiosPromise { return localVarFp.getPublicKey(entityId, options).then((request) => request(axios, basePath)); }, /** * This lock an entity permanently, or temporarily to a specific time. * @summary Lock an entity * @param {string} entityId Entity ID * @param {LockEntityRequest} [lockEntityRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ lockEntity(entityId: string, lockEntityRequest?: LockEntityRequest, options?: any): AxiosPromise { return localVarFp.lockEntity(entityId, lockEntityRequest, options).then((request) => request(axios, basePath)); }, /** * This unlock an entity from both permanent or temporary locking status. * @summary Unlock an entity * @param {string} entityId Entity ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ unlockEntity(entityId: string, options?: any): AxiosPromise { return localVarFp.unlockEntity(entityId, options).then((request) => request(axios, basePath)); }, }; }; /** * CommonApi - interface * @export * @interface CommonApi */ export interface CommonApiInterface { /** * This fetches an encrypted private keys and corresponding public keys. * @summary Key pairs * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApiInterface */ getKeyPairs(options?: AxiosRequestConfig): AxiosPromise; /** * This returns public key of signing and encryption. * @summary Gets public key * @param {string} [entityId] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApiInterface */ getPublicKey(entityId?: string, options?: AxiosRequestConfig): AxiosPromise; /** * This lock an entity permanently, or temporarily to a specific time. * @summary Lock an entity * @param {string} entityId Entity ID * @param {LockEntityRequest} [lockEntityRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApiInterface */ lockEntity(entityId: string, lockEntityRequest?: LockEntityRequest, options?: AxiosRequestConfig): AxiosPromise; /** * This unlock an entity from both permanent or temporary locking status. * @summary Unlock an entity * @param {string} entityId Entity ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApiInterface */ unlockEntity(entityId: string, options?: AxiosRequestConfig): AxiosPromise; } /** * CommonApi - object-oriented interface * @export * @class CommonApi * @extends {BaseAPI} */ export class CommonApi extends BaseAPI implements CommonApiInterface { /** * This fetches an encrypted private keys and corresponding public keys. * @summary Key pairs * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApi */ public getKeyPairs(options?: AxiosRequestConfig) { return CommonApiFp(this.configuration).getKeyPairs(options).then((request) => request(this.axios, this.basePath)); } /** * This returns public key of signing and encryption. * @summary Gets public key * @param {string} [entityId] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApi */ public getPublicKey(entityId?: string, options?: AxiosRequestConfig) { return CommonApiFp(this.configuration).getPublicKey(entityId, options).then((request) => request(this.axios, this.basePath)); } /** * This lock an entity permanently, or temporarily to a specific time. * @summary Lock an entity * @param {string} entityId Entity ID * @param {LockEntityRequest} [lockEntityRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApi */ public lockEntity(entityId: string, lockEntityRequest?: LockEntityRequest, options?: AxiosRequestConfig) { return CommonApiFp(this.configuration).lockEntity(entityId, lockEntityRequest, options).then((request) => request(this.axios, this.basePath)); } /** * This unlock an entity from both permanent or temporary locking status. * @summary Unlock an entity * @param {string} entityId Entity ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApi */ public unlockEntity(entityId: string, options?: AxiosRequestConfig) { return CommonApiFp(this.configuration).unlockEntity(entityId, options).then((request) => request(this.axios, this.basePath)); } }