/* 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 { DraftReviewAndValidationResponse } from '../models'; // @ts-ignore import { ErrorSchema } from '../models'; // @ts-ignore import { PolicyAndValidationResponse } from '../models'; // @ts-ignore import { PolicyType } from '../models'; // @ts-ignore import { PublishDraftRequest } from '../models'; // @ts-ignore import { PublishResult } from '../models'; // @ts-ignore import { UpdateDraftRequest } from '../models'; /** * PolicyEditorV2Api - axios parameter creator * @export */ export const PolicyEditorV2ApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Returns the active policy and its validation for a specific policy type. Endpoint Permissions: Owner, Admin, Non-Signing Admin. * @summary Get the active policy and its validation by policy type * @param {PolicyType} policyType The policy type(s) to retrieve. Can be a single type or multiple types by repeating the parameter (e.g., ?policyType=TRANSFER&policyType=MINT). * @param {*} [options] Override http request option. * @throws {RequiredError} */ getActivePolicy: async (policyType: PolicyType, options: RawAxiosRequestConfig = {}): Promise => { assertParamExists('getActivePolicy', 'policyType', policyType) const localVarPath = `/policy/active_policy`; // 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 = 'getActivePolicy'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (policyType !== undefined) { localVarQueryParameter['policyType'] = policyType; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Returns the active draft and its validation for a specific policy type. * @summary Get the active draft by policy type * @param {PolicyType} policyType The policy type(s) to retrieve. Can be a single type or multiple types by repeating the parameter (e.g., ?policyType=TRANSFER&policyType=MINT). * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDraft: async (policyType: PolicyType, options: RawAxiosRequestConfig = {}): Promise => { assertParamExists('getDraft', 'policyType', policyType) const localVarPath = `/policy/draft`; // 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 = 'getDraft'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (policyType !== undefined) { localVarQueryParameter['policyType'] = policyType; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Send publish request of certain draft id and returns the response. **⚠️ IMPORTANT SECURITY NOTICE:** The Fireblocks Policy is a critical security guardrail. Programmatically modifying your policy via the API introduces significant security risks. As an industry best practice, Fireblocks strongly recommends manual editing accompanied by strict human oversight and approval workflows for all policy changes. Programmatic updates should only be implemented by advanced users with comprehensive, multi-layer security controls in place. If you want to learn more about the Fireblocks Policy Editor, please contact your Fireblocks Customer Success Manager or send an email to CSM@fireblocks.com. * @summary Send publish request for a certain draft id * @param {PublishDraftRequest} publishDraftRequest * @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} */ publishDraft: async (publishDraftRequest: PublishDraftRequest, idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { assertParamExists('publishDraft', 'publishDraftRequest', publishDraftRequest) const localVarPath = `/policy/draft`; // 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 = 'publishDraft'; 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(publishDraftRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Update the draft and return its validation for specific policy types. **⚠️ IMPORTANT SECURITY NOTICE:** The Fireblocks Policy is a critical security guardrail. Programmatically modifying your policy via the API introduces significant security risks. As an industry best practice, Fireblocks strongly recommends manual editing accompanied by strict human oversight and approval workflows for all policy changes. Programmatic updates should only be implemented by advanced users with comprehensive, multi-layer security controls in place. * @summary Update the draft with a new set of rules by policy types * @param {UpdateDraftRequest} updateDraftRequest * @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} */ updateDraft: async (updateDraftRequest: UpdateDraftRequest, idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { assertParamExists('updateDraft', 'updateDraftRequest', updateDraftRequest) const localVarPath = `/policy/draft`; // 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: 'PUT', ...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 = 'updateDraft'; 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(updateDraftRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * PolicyEditorV2Api - functional programming interface * @export */ export const PolicyEditorV2ApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = PolicyEditorV2ApiAxiosParamCreator(configuration) return { /** * Returns the active policy and its validation for a specific policy type. Endpoint Permissions: Owner, Admin, Non-Signing Admin. * @summary Get the active policy and its validation by policy type * @param {PolicyType} policyType The policy type(s) to retrieve. Can be a single type or multiple types by repeating the parameter (e.g., ?policyType=TRANSFER&policyType=MINT). * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getActivePolicy(policyType: PolicyType, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getActivePolicy(policyType, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['PolicyEditorV2Api.getActivePolicy']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Returns the active draft and its validation for a specific policy type. * @summary Get the active draft by policy type * @param {PolicyType} policyType The policy type(s) to retrieve. Can be a single type or multiple types by repeating the parameter (e.g., ?policyType=TRANSFER&policyType=MINT). * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDraft(policyType: PolicyType, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getDraft(policyType, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['PolicyEditorV2Api.getDraft']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Send publish request of certain draft id and returns the response. **⚠️ IMPORTANT SECURITY NOTICE:** The Fireblocks Policy is a critical security guardrail. Programmatically modifying your policy via the API introduces significant security risks. As an industry best practice, Fireblocks strongly recommends manual editing accompanied by strict human oversight and approval workflows for all policy changes. Programmatic updates should only be implemented by advanced users with comprehensive, multi-layer security controls in place. If you want to learn more about the Fireblocks Policy Editor, please contact your Fireblocks Customer Success Manager or send an email to CSM@fireblocks.com. * @summary Send publish request for a certain draft id * @param {PublishDraftRequest} publishDraftRequest * @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 publishDraft(publishDraftRequest: PublishDraftRequest, idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.publishDraft(publishDraftRequest, idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['PolicyEditorV2Api.publishDraft']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Update the draft and return its validation for specific policy types. **⚠️ IMPORTANT SECURITY NOTICE:** The Fireblocks Policy is a critical security guardrail. Programmatically modifying your policy via the API introduces significant security risks. As an industry best practice, Fireblocks strongly recommends manual editing accompanied by strict human oversight and approval workflows for all policy changes. Programmatic updates should only be implemented by advanced users with comprehensive, multi-layer security controls in place. * @summary Update the draft with a new set of rules by policy types * @param {UpdateDraftRequest} updateDraftRequest * @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 updateDraft(updateDraftRequest: UpdateDraftRequest, idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.updateDraft(updateDraftRequest, idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['PolicyEditorV2Api.updateDraft']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * PolicyEditorV2Api - factory interface * @export */ export const PolicyEditorV2ApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = PolicyEditorV2ApiFp(configuration) return { /** * Returns the active policy and its validation for a specific policy type. Endpoint Permissions: Owner, Admin, Non-Signing Admin. * @summary Get the active policy and its validation by policy type * @param {PolicyEditorV2ApiGetActivePolicyRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getActivePolicy(requestParameters: PolicyEditorV2ApiGetActivePolicyRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getActivePolicy(requestParameters.policyType, options).then((request) => request(axios, basePath)); }, /** * Returns the active draft and its validation for a specific policy type. * @summary Get the active draft by policy type * @param {PolicyEditorV2ApiGetDraftRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDraft(requestParameters: PolicyEditorV2ApiGetDraftRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getDraft(requestParameters.policyType, options).then((request) => request(axios, basePath)); }, /** * Send publish request of certain draft id and returns the response. **⚠️ IMPORTANT SECURITY NOTICE:** The Fireblocks Policy is a critical security guardrail. Programmatically modifying your policy via the API introduces significant security risks. As an industry best practice, Fireblocks strongly recommends manual editing accompanied by strict human oversight and approval workflows for all policy changes. Programmatic updates should only be implemented by advanced users with comprehensive, multi-layer security controls in place. If you want to learn more about the Fireblocks Policy Editor, please contact your Fireblocks Customer Success Manager or send an email to CSM@fireblocks.com. * @summary Send publish request for a certain draft id * @param {PolicyEditorV2ApiPublishDraftRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ publishDraft(requestParameters: PolicyEditorV2ApiPublishDraftRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.publishDraft(requestParameters.publishDraftRequest, requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, /** * Update the draft and return its validation for specific policy types. **⚠️ IMPORTANT SECURITY NOTICE:** The Fireblocks Policy is a critical security guardrail. Programmatically modifying your policy via the API introduces significant security risks. As an industry best practice, Fireblocks strongly recommends manual editing accompanied by strict human oversight and approval workflows for all policy changes. Programmatic updates should only be implemented by advanced users with comprehensive, multi-layer security controls in place. * @summary Update the draft with a new set of rules by policy types * @param {PolicyEditorV2ApiUpdateDraftRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateDraft(requestParameters: PolicyEditorV2ApiUpdateDraftRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.updateDraft(requestParameters.updateDraftRequest, requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for getActivePolicy operation in PolicyEditorV2Api. * @export * @interface PolicyEditorV2ApiGetActivePolicyRequest */ export interface PolicyEditorV2ApiGetActivePolicyRequest { /** * The policy type(s) to retrieve. Can be a single type or multiple types by repeating the parameter (e.g., ?policyType=TRANSFER&policyType=MINT). * @type {PolicyType} * @memberof PolicyEditorV2ApiGetActivePolicy */ readonly policyType: PolicyType } /** * Request parameters for getDraft operation in PolicyEditorV2Api. * @export * @interface PolicyEditorV2ApiGetDraftRequest */ export interface PolicyEditorV2ApiGetDraftRequest { /** * The policy type(s) to retrieve. Can be a single type or multiple types by repeating the parameter (e.g., ?policyType=TRANSFER&policyType=MINT). * @type {PolicyType} * @memberof PolicyEditorV2ApiGetDraft */ readonly policyType: PolicyType } /** * Request parameters for publishDraft operation in PolicyEditorV2Api. * @export * @interface PolicyEditorV2ApiPublishDraftRequest */ export interface PolicyEditorV2ApiPublishDraftRequest { /** * * @type {PublishDraftRequest} * @memberof PolicyEditorV2ApiPublishDraft */ readonly publishDraftRequest: PublishDraftRequest /** * 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 PolicyEditorV2ApiPublishDraft */ readonly idempotencyKey?: string } /** * Request parameters for updateDraft operation in PolicyEditorV2Api. * @export * @interface PolicyEditorV2ApiUpdateDraftRequest */ export interface PolicyEditorV2ApiUpdateDraftRequest { /** * * @type {UpdateDraftRequest} * @memberof PolicyEditorV2ApiUpdateDraft */ readonly updateDraftRequest: UpdateDraftRequest /** * 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 PolicyEditorV2ApiUpdateDraft */ readonly idempotencyKey?: string } /** * PolicyEditorV2Api - object-oriented interface * @export * @class PolicyEditorV2Api * @extends {BaseAPI} */ export class PolicyEditorV2Api extends BaseAPI { /** * Returns the active policy and its validation for a specific policy type. Endpoint Permissions: Owner, Admin, Non-Signing Admin. * @summary Get the active policy and its validation by policy type * @param {PolicyEditorV2ApiGetActivePolicyRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyEditorV2Api */ public getActivePolicy(requestParameters: PolicyEditorV2ApiGetActivePolicyRequest) { return PolicyEditorV2ApiFp(this.configuration).getActivePolicy(requestParameters.policyType).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Returns the active draft and its validation for a specific policy type. * @summary Get the active draft by policy type * @param {PolicyEditorV2ApiGetDraftRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyEditorV2Api */ public getDraft(requestParameters: PolicyEditorV2ApiGetDraftRequest) { return PolicyEditorV2ApiFp(this.configuration).getDraft(requestParameters.policyType).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Send publish request of certain draft id and returns the response. **⚠️ IMPORTANT SECURITY NOTICE:** The Fireblocks Policy is a critical security guardrail. Programmatically modifying your policy via the API introduces significant security risks. As an industry best practice, Fireblocks strongly recommends manual editing accompanied by strict human oversight and approval workflows for all policy changes. Programmatic updates should only be implemented by advanced users with comprehensive, multi-layer security controls in place. If you want to learn more about the Fireblocks Policy Editor, please contact your Fireblocks Customer Success Manager or send an email to CSM@fireblocks.com. * @summary Send publish request for a certain draft id * @param {PolicyEditorV2ApiPublishDraftRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyEditorV2Api */ public publishDraft(requestParameters: PolicyEditorV2ApiPublishDraftRequest) { return PolicyEditorV2ApiFp(this.configuration).publishDraft(requestParameters.publishDraftRequest, requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Update the draft and return its validation for specific policy types. **⚠️ IMPORTANT SECURITY NOTICE:** The Fireblocks Policy is a critical security guardrail. Programmatically modifying your policy via the API introduces significant security risks. As an industry best practice, Fireblocks strongly recommends manual editing accompanied by strict human oversight and approval workflows for all policy changes. Programmatic updates should only be implemented by advanced users with comprehensive, multi-layer security controls in place. * @summary Update the draft with a new set of rules by policy types * @param {PolicyEditorV2ApiUpdateDraftRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyEditorV2Api */ public updateDraft(requestParameters: PolicyEditorV2ApiUpdateDraftRequest) { return PolicyEditorV2ApiFp(this.configuration).updateDraft(requestParameters.updateDraftRequest, requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } }