/* 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 { ConsoleUser } from '../models'; // @ts-ignore import { CreateConsoleUser } from '../models'; // @ts-ignore import { ErrorResponse } from '../models'; // @ts-ignore import { ErrorSchema } from '../models'; // @ts-ignore import { GetConsoleUsersResponse } from '../models'; /** * ConsoleUserApi - axios parameter creator * @export */ export const ConsoleUserApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Create console users in your workspace - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Learn more about Fireblocks Users management in the following [guide](https://developers.fireblocks.com/docs/manage-users). Endpoint Permission: Admin, Non-Signing Admin. * @summary Create console user * @param {CreateConsoleUser} [createConsoleUser] * @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} */ createConsoleUser: async (createConsoleUser?: CreateConsoleUser, idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/management/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 = 'createConsoleUser'; 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(createConsoleUser, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Requests deletion of a console user. The request is asynchronous: it goes through the workspace\'s configured \"Delete users\" approval policy (Settings > Quorums), exactly as deleting a user from the console does, and the user is removed only once that approval completes. - The workspace must have a \"Delete users\" approval policy (admin quorum or approval group). If \"Delete users\" is Owner-only, which is the default, the request is refused with OWNER_ONLY (2760) and the Owner deletes users in the Console. With an admin quorum, the requesting API user\'s own approval counts toward the quorum. - Track progress by polling GET /management/users; deletion is complete when the user is disabled. - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin/Security Admin permissions. Endpoint Permission: Admin, Non-Signing Admin, Security Admin. **Note:** This endpoint is in Early Availability (EA) and may change or break before it reaches GA. * @summary Request deletion of a console user * @param {string} id The ID of the console user to delete * @param {boolean} [force] Acknowledges the impact of removing this user and proceeds anyway. Overrides both USER_REFERENCED_IN_TAP and QUORUM_INTEGRITY, the same way the acknowledgement checkbox does in the console. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteConsoleUser: async (id: string, force?: boolean, options: RawAxiosRequestConfig = {}): Promise => { assertParamExistsAndNotEmpty('deleteConsoleUser', 'id', id) const localVarPath = `/management/users/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'DELETE', ...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 = 'deleteConsoleUser'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (force !== undefined) { localVarQueryParameter['force'] = force; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get console users for 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 console users * @param {*} [options] Override http request option. * @throws {RequiredError} */ getConsoleUsers: async (options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/management/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 = 'getConsoleUsers'; 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, }; }, } }; /** * ConsoleUserApi - functional programming interface * @export */ export const ConsoleUserApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = ConsoleUserApiAxiosParamCreator(configuration) return { /** * Create console users in your workspace - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Learn more about Fireblocks Users management in the following [guide](https://developers.fireblocks.com/docs/manage-users). Endpoint Permission: Admin, Non-Signing Admin. * @summary Create console user * @param {CreateConsoleUser} [createConsoleUser] * @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 createConsoleUser(createConsoleUser?: CreateConsoleUser, idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createConsoleUser(createConsoleUser, idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ConsoleUserApi.createConsoleUser']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Requests deletion of a console user. The request is asynchronous: it goes through the workspace\'s configured \"Delete users\" approval policy (Settings > Quorums), exactly as deleting a user from the console does, and the user is removed only once that approval completes. - The workspace must have a \"Delete users\" approval policy (admin quorum or approval group). If \"Delete users\" is Owner-only, which is the default, the request is refused with OWNER_ONLY (2760) and the Owner deletes users in the Console. With an admin quorum, the requesting API user\'s own approval counts toward the quorum. - Track progress by polling GET /management/users; deletion is complete when the user is disabled. - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin/Security Admin permissions. Endpoint Permission: Admin, Non-Signing Admin, Security Admin. **Note:** This endpoint is in Early Availability (EA) and may change or break before it reaches GA. * @summary Request deletion of a console user * @param {string} id The ID of the console user to delete * @param {boolean} [force] Acknowledges the impact of removing this user and proceeds anyway. Overrides both USER_REFERENCED_IN_TAP and QUORUM_INTEGRITY, the same way the acknowledgement checkbox does in the console. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async deleteConsoleUser(id: string, force?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteConsoleUser(id, force, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ConsoleUserApi.deleteConsoleUser']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Get console users for 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 console users * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getConsoleUsers(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getConsoleUsers(options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ConsoleUserApi.getConsoleUsers']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * ConsoleUserApi - factory interface * @export */ export const ConsoleUserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = ConsoleUserApiFp(configuration) return { /** * Create console users in your workspace - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Learn more about Fireblocks Users management in the following [guide](https://developers.fireblocks.com/docs/manage-users). Endpoint Permission: Admin, Non-Signing Admin. * @summary Create console user * @param {ConsoleUserApiCreateConsoleUserRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createConsoleUser(requestParameters: ConsoleUserApiCreateConsoleUserRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.createConsoleUser(requestParameters.createConsoleUser, requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, /** * Requests deletion of a console user. The request is asynchronous: it goes through the workspace\'s configured \"Delete users\" approval policy (Settings > Quorums), exactly as deleting a user from the console does, and the user is removed only once that approval completes. - The workspace must have a \"Delete users\" approval policy (admin quorum or approval group). If \"Delete users\" is Owner-only, which is the default, the request is refused with OWNER_ONLY (2760) and the Owner deletes users in the Console. With an admin quorum, the requesting API user\'s own approval counts toward the quorum. - Track progress by polling GET /management/users; deletion is complete when the user is disabled. - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin/Security Admin permissions. Endpoint Permission: Admin, Non-Signing Admin, Security Admin. **Note:** This endpoint is in Early Availability (EA) and may change or break before it reaches GA. * @summary Request deletion of a console user * @param {ConsoleUserApiDeleteConsoleUserRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteConsoleUser(requestParameters: ConsoleUserApiDeleteConsoleUserRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.deleteConsoleUser(requestParameters.id, requestParameters.force, options).then((request) => request(axios, basePath)); }, /** * Get console users for 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 console users * @param {*} [options] Override http request option. * @throws {RequiredError} */ getConsoleUsers(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getConsoleUsers(options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for createConsoleUser operation in ConsoleUserApi. * @export * @interface ConsoleUserApiCreateConsoleUserRequest */ export interface ConsoleUserApiCreateConsoleUserRequest { /** * * @type {CreateConsoleUser} * @memberof ConsoleUserApiCreateConsoleUser */ readonly createConsoleUser?: CreateConsoleUser /** * 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 ConsoleUserApiCreateConsoleUser */ readonly idempotencyKey?: string } /** * Request parameters for deleteConsoleUser operation in ConsoleUserApi. * @export * @interface ConsoleUserApiDeleteConsoleUserRequest */ export interface ConsoleUserApiDeleteConsoleUserRequest { /** * The ID of the console user to delete * @type {string} * @memberof ConsoleUserApiDeleteConsoleUser */ readonly id: string /** * Acknowledges the impact of removing this user and proceeds anyway. Overrides both USER_REFERENCED_IN_TAP and QUORUM_INTEGRITY, the same way the acknowledgement checkbox does in the console. * @type {boolean} * @memberof ConsoleUserApiDeleteConsoleUser */ readonly force?: boolean } /** * ConsoleUserApi - object-oriented interface * @export * @class ConsoleUserApi * @extends {BaseAPI} */ export class ConsoleUserApi extends BaseAPI { /** * Create console users in your workspace - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Learn more about Fireblocks Users management in the following [guide](https://developers.fireblocks.com/docs/manage-users). Endpoint Permission: Admin, Non-Signing Admin. * @summary Create console user * @param {ConsoleUserApiCreateConsoleUserRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ConsoleUserApi */ public createConsoleUser(requestParameters: ConsoleUserApiCreateConsoleUserRequest = {}) { return ConsoleUserApiFp(this.configuration).createConsoleUser(requestParameters.createConsoleUser, requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Requests deletion of a console user. The request is asynchronous: it goes through the workspace\'s configured \"Delete users\" approval policy (Settings > Quorums), exactly as deleting a user from the console does, and the user is removed only once that approval completes. - The workspace must have a \"Delete users\" approval policy (admin quorum or approval group). If \"Delete users\" is Owner-only, which is the default, the request is refused with OWNER_ONLY (2760) and the Owner deletes users in the Console. With an admin quorum, the requesting API user\'s own approval counts toward the quorum. - Track progress by polling GET /management/users; deletion is complete when the user is disabled. - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin/Security Admin permissions. Endpoint Permission: Admin, Non-Signing Admin, Security Admin. **Note:** This endpoint is in Early Availability (EA) and may change or break before it reaches GA. * @summary Request deletion of a console user * @param {ConsoleUserApiDeleteConsoleUserRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ConsoleUserApi */ public deleteConsoleUser(requestParameters: ConsoleUserApiDeleteConsoleUserRequest) { return ConsoleUserApiFp(this.configuration).deleteConsoleUser(requestParameters.id, requestParameters.force).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Get console users for 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 console users * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ConsoleUserApi */ public getConsoleUsers() { return ConsoleUserApiFp(this.configuration).getConsoleUsers().then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } }