/* tslint:disable */ /* eslint-disable */ /** * Fireblocks API * Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain. - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com) * * The version of the OpenAPI document: 1.6.2 * Contact: developers@fireblocks.com * * 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'; import { convertToFireblocksResponse } from "../response/fireblocksResponse"; // 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'; import { assertParamExistsAndNotEmpty } from '../utils/validation_utils'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; // @ts-ignore import { CreateAPIUser } from '../models'; // @ts-ignore import { ErrorResponse } from '../models'; // @ts-ignore import { ErrorSchema } from '../models'; // @ts-ignore import { GetAPIUsersResponse } from '../models'; // @ts-ignore import { IssueApiUserPairingTokenResponse } from '../models'; /** * ApiUserApi - axios parameter creator * @export */ export const ApiUserApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Create a new API key in your workspace. Learn more about Fireblocks API Keys management in the following [guide](https://developers.fireblocks.com/docs/manage-api-keys). Endpoint Permission: Admin, Non-Signing Admin. * @summary Create API Key * @param {CreateAPIUser} [createAPIUser] * @param {string} [idempotencyKey] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createApiUser: async (createAPIUser?: CreateAPIUser, idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/management/api_users`; // 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}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'createApiUser'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (idempotencyKey != null) { localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey); } localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(createAPIUser, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * List all API keys in your workspace. - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Endpoint Permission: Admin, Non-Signing Admin. * @summary Get API Keys * @param {*} [options] Override http request option. * @throws {RequiredError} */ getApiUsers: async (options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/management/api_users`; // 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}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'getApiUsers'; 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, }; }, /** * Issues a device pairing token for the given user and returns the user\'s info along with the token. - The API user must be in PENDING_ACTIVATION status. If the user is already set up (enabled), the request is rejected with a 409 Conflict. - Please note that this endpoint is available only for API keys with Owner/Admin/Non Signing Admin permissions. - This is the same pairing token that the API Co-signer requests during installation and when you pair an additional API user with an existing Co-signer. You can use this endpoint instead of copying the token from Pair API user in the Console. The token is valid for one hour. * @summary Issue API user pairing token * @param {string} userId The ID of the api user * @param {string} [idempotencyKey] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @param {*} [options] Override http request option. * @throws {RequiredError} */ issueApiUserPairingToken: async (userId: string, idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { assertParamExistsAndNotEmpty('issueApiUserPairingToken', 'userId', userId) const localVarPath = `/management/api_users/{userId}/pairing_token` .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); // 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}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'issueApiUserPairingToken'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (idempotencyKey != null) { localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey); } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * ApiUserApi - functional programming interface * @export */ export const ApiUserApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = ApiUserApiAxiosParamCreator(configuration) return { /** * Create a new API key in your workspace. Learn more about Fireblocks API Keys management in the following [guide](https://developers.fireblocks.com/docs/manage-api-keys). Endpoint Permission: Admin, Non-Signing Admin. * @summary Create API Key * @param {CreateAPIUser} [createAPIUser] * @param {string} [idempotencyKey] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createApiUser(createAPIUser?: CreateAPIUser, idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createApiUser(createAPIUser, idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ApiUserApi.createApiUser']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * List all API keys in your workspace. - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Endpoint Permission: Admin, Non-Signing Admin. * @summary Get API Keys * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getApiUsers(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getApiUsers(options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ApiUserApi.getApiUsers']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Issues a device pairing token for the given user and returns the user\'s info along with the token. - The API user must be in PENDING_ACTIVATION status. If the user is already set up (enabled), the request is rejected with a 409 Conflict. - Please note that this endpoint is available only for API keys with Owner/Admin/Non Signing Admin permissions. - This is the same pairing token that the API Co-signer requests during installation and when you pair an additional API user with an existing Co-signer. You can use this endpoint instead of copying the token from Pair API user in the Console. The token is valid for one hour. * @summary Issue API user pairing token * @param {string} userId The ID of the api user * @param {string} [idempotencyKey] A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async issueApiUserPairingToken(userId: string, idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.issueApiUserPairingToken(userId, idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ApiUserApi.issueApiUserPairingToken']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * ApiUserApi - factory interface * @export */ export const ApiUserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = ApiUserApiFp(configuration) return { /** * Create a new API key in your workspace. Learn more about Fireblocks API Keys management in the following [guide](https://developers.fireblocks.com/docs/manage-api-keys). Endpoint Permission: Admin, Non-Signing Admin. * @summary Create API Key * @param {ApiUserApiCreateApiUserRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createApiUser(requestParameters: ApiUserApiCreateApiUserRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.createApiUser(requestParameters.createAPIUser, requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, /** * List all API keys in your workspace. - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Endpoint Permission: Admin, Non-Signing Admin. * @summary Get API Keys * @param {*} [options] Override http request option. * @throws {RequiredError} */ getApiUsers(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getApiUsers(options).then((request) => request(axios, basePath)); }, /** * Issues a device pairing token for the given user and returns the user\'s info along with the token. - The API user must be in PENDING_ACTIVATION status. If the user is already set up (enabled), the request is rejected with a 409 Conflict. - Please note that this endpoint is available only for API keys with Owner/Admin/Non Signing Admin permissions. - This is the same pairing token that the API Co-signer requests during installation and when you pair an additional API user with an existing Co-signer. You can use this endpoint instead of copying the token from Pair API user in the Console. The token is valid for one hour. * @summary Issue API user pairing token * @param {ApiUserApiIssueApiUserPairingTokenRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ issueApiUserPairingToken(requestParameters: ApiUserApiIssueApiUserPairingTokenRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.issueApiUserPairingToken(requestParameters.userId, requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for createApiUser operation in ApiUserApi. * @export * @interface ApiUserApiCreateApiUserRequest */ export interface ApiUserApiCreateApiUserRequest { /** * * @type {CreateAPIUser} * @memberof ApiUserApiCreateApiUser */ readonly createAPIUser?: CreateAPIUser /** * A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @type {string} * @memberof ApiUserApiCreateApiUser */ readonly idempotencyKey?: string } /** * Request parameters for issueApiUserPairingToken operation in ApiUserApi. * @export * @interface ApiUserApiIssueApiUserPairingTokenRequest */ export interface ApiUserApiIssueApiUserPairingTokenRequest { /** * The ID of the api user * @type {string} * @memberof ApiUserApiIssueApiUserPairingToken */ readonly userId: string /** * A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. * @type {string} * @memberof ApiUserApiIssueApiUserPairingToken */ readonly idempotencyKey?: string } /** * ApiUserApi - object-oriented interface * @export * @class ApiUserApi * @extends {BaseAPI} */ export class ApiUserApi extends BaseAPI { /** * Create a new API key in your workspace. Learn more about Fireblocks API Keys management in the following [guide](https://developers.fireblocks.com/docs/manage-api-keys). Endpoint Permission: Admin, Non-Signing Admin. * @summary Create API Key * @param {ApiUserApiCreateApiUserRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApiUserApi */ public createApiUser(requestParameters: ApiUserApiCreateApiUserRequest = {}) { return ApiUserApiFp(this.configuration).createApiUser(requestParameters.createAPIUser, requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * List all API keys in your workspace. - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Endpoint Permission: Admin, Non-Signing Admin. * @summary Get API Keys * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApiUserApi */ public getApiUsers() { return ApiUserApiFp(this.configuration).getApiUsers().then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Issues a device pairing token for the given user and returns the user\'s info along with the token. - The API user must be in PENDING_ACTIVATION status. If the user is already set up (enabled), the request is rejected with a 409 Conflict. - Please note that this endpoint is available only for API keys with Owner/Admin/Non Signing Admin permissions. - This is the same pairing token that the API Co-signer requests during installation and when you pair an additional API user with an existing Co-signer. You can use this endpoint instead of copying the token from Pair API user in the Console. The token is valid for one hour. * @summary Issue API user pairing token * @param {ApiUserApiIssueApiUserPairingTokenRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApiUserApi */ public issueApiUserPairingToken(requestParameters: ApiUserApiIssueApiUserPairingTokenRequest) { return ApiUserApiFp(this.configuration).issueApiUserPairingToken(requestParameters.userId, requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } }