/* 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 { CallAccepted } from '../models'; // @ts-ignore import { CantonCall } from '../models'; // @ts-ignore import { ErrorSchema } from '../models'; // @ts-ignore import { OfferResponse } from '../models'; // @ts-ignore import { OfferResponseAccepted } from '../models'; /** * CantonBetaApi - axios parameter creator * @export */ export const CantonBetaApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Submits a Canton call from a vault account\'s Canton wallet. `type` selects the call and the shape of `payload`. * @summary Make a Canton call * @param {CantonCall} cantonCall * @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} */ createCantonCall: async (cantonCall: CantonCall, idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { assertParamExists('createCantonCall', 'cantonCall', cantonCall) const localVarPath = `/operations/canton/calls`; // 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 = 'createCantonCall'; 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(cantonCall, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Responds to an incoming Canton offer. Set `responseType` to one of the values in the offer transaction\'s `cantonDetails.offerResponse.availableResponses`. * @summary Answer an offer * @param {OfferResponse} offerResponse * @param {string} offerId The Fireblocks transaction id of the incoming offer being answered. * @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} */ respondToCantonOffer: async (offerResponse: OfferResponse, offerId: string, idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { assertParamExists('respondToCantonOffer', 'offerResponse', offerResponse) assertParamExistsAndNotEmpty('respondToCantonOffer', 'offerId', offerId) const localVarPath = `/operations/canton/offers/{offerId}/responses` .replace(`{${"offerId"}}`, encodeURIComponent(String(offerId))); // 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 = 'respondToCantonOffer'; 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(offerResponse, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * CantonBetaApi - functional programming interface * @export */ export const CantonBetaApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = CantonBetaApiAxiosParamCreator(configuration) return { /** * Submits a Canton call from a vault account\'s Canton wallet. `type` selects the call and the shape of `payload`. * @summary Make a Canton call * @param {CantonCall} cantonCall * @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 createCantonCall(cantonCall: CantonCall, idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createCantonCall(cantonCall, idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['CantonBetaApi.createCantonCall']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Responds to an incoming Canton offer. Set `responseType` to one of the values in the offer transaction\'s `cantonDetails.offerResponse.availableResponses`. * @summary Answer an offer * @param {OfferResponse} offerResponse * @param {string} offerId The Fireblocks transaction id of the incoming offer being answered. * @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 respondToCantonOffer(offerResponse: OfferResponse, offerId: string, idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.respondToCantonOffer(offerResponse, offerId, idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['CantonBetaApi.respondToCantonOffer']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * CantonBetaApi - factory interface * @export */ export const CantonBetaApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = CantonBetaApiFp(configuration) return { /** * Submits a Canton call from a vault account\'s Canton wallet. `type` selects the call and the shape of `payload`. * @summary Make a Canton call * @param {CantonBetaApiCreateCantonCallRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createCantonCall(requestParameters: CantonBetaApiCreateCantonCallRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.createCantonCall(requestParameters.cantonCall, requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, /** * Responds to an incoming Canton offer. Set `responseType` to one of the values in the offer transaction\'s `cantonDetails.offerResponse.availableResponses`. * @summary Answer an offer * @param {CantonBetaApiRespondToCantonOfferRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ respondToCantonOffer(requestParameters: CantonBetaApiRespondToCantonOfferRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.respondToCantonOffer(requestParameters.offerResponse, requestParameters.offerId, requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for createCantonCall operation in CantonBetaApi. * @export * @interface CantonBetaApiCreateCantonCallRequest */ export interface CantonBetaApiCreateCantonCallRequest { /** * * @type {CantonCall} * @memberof CantonBetaApiCreateCantonCall */ readonly cantonCall: CantonCall /** * 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 CantonBetaApiCreateCantonCall */ readonly idempotencyKey?: string } /** * Request parameters for respondToCantonOffer operation in CantonBetaApi. * @export * @interface CantonBetaApiRespondToCantonOfferRequest */ export interface CantonBetaApiRespondToCantonOfferRequest { /** * * @type {OfferResponse} * @memberof CantonBetaApiRespondToCantonOffer */ readonly offerResponse: OfferResponse /** * The Fireblocks transaction id of the incoming offer being answered. * @type {string} * @memberof CantonBetaApiRespondToCantonOffer */ readonly offerId: 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 CantonBetaApiRespondToCantonOffer */ readonly idempotencyKey?: string } /** * CantonBetaApi - object-oriented interface * @export * @class CantonBetaApi * @extends {BaseAPI} */ export class CantonBetaApi extends BaseAPI { /** * Submits a Canton call from a vault account\'s Canton wallet. `type` selects the call and the shape of `payload`. * @summary Make a Canton call * @param {CantonBetaApiCreateCantonCallRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CantonBetaApi */ public createCantonCall(requestParameters: CantonBetaApiCreateCantonCallRequest) { return CantonBetaApiFp(this.configuration).createCantonCall(requestParameters.cantonCall, requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Responds to an incoming Canton offer. Set `responseType` to one of the values in the offer transaction\'s `cantonDetails.offerResponse.availableResponses`. * @summary Answer an offer * @param {CantonBetaApiRespondToCantonOfferRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CantonBetaApi */ public respondToCantonOffer(requestParameters: CantonBetaApiRespondToCantonOfferRequest) { return CantonBetaApiFp(this.configuration).respondToCantonOffer(requestParameters.offerResponse, requestParameters.offerId, requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } }