/* 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 { ErrorSchema } from '../models'; // @ts-ignore import { GenieChatMessage } from '../models'; // @ts-ignore import { GenieCreateSessionResponse } from '../models'; // @ts-ignore import { GenieSendMessageRequest } from '../models'; /** * GenieBetaApi - axios parameter creator * @export */ export const GenieBetaApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Starts a new conversation with Genie, the Fireblocks AI assistant. Returns a `sessionId` — pass it when sending messages, and reuse it across calls to keep one continuous conversation. **Note:** This endpoint is currently in beta and might be subject to changes. * @summary Create a Genie session * @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} */ createGenieSession: async (idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/genie/sessions`; // 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 = 'createGenieSession'; 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, }; }, /** * Sends a question to Genie and returns a single answer. Reuse the `sessionId` from the original session on follow-up messages to continue the conversation with prior context. **Note:** This endpoint is currently in beta and might be subject to changes. * @summary Send a message to a Genie session * @param {GenieSendMessageRequest} genieSendMessageRequest * @param {string} sessionId The Genie session ID returned from `POST /genie/sessions`. * @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} */ sendGenieMessage: async (genieSendMessageRequest: GenieSendMessageRequest, sessionId: string, idempotencyKey?: string, options: RawAxiosRequestConfig = {}): Promise => { assertParamExists('sendGenieMessage', 'genieSendMessageRequest', genieSendMessageRequest) assertParamExistsAndNotEmpty('sendGenieMessage', 'sessionId', sessionId) const localVarPath = `/genie/sessions/{sessionId}/messages` .replace(`{${"sessionId"}}`, encodeURIComponent(String(sessionId))); // 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 = 'sendGenieMessage'; 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(genieSendMessageRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * GenieBetaApi - functional programming interface * @export */ export const GenieBetaApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = GenieBetaApiAxiosParamCreator(configuration) return { /** * Starts a new conversation with Genie, the Fireblocks AI assistant. Returns a `sessionId` — pass it when sending messages, and reuse it across calls to keep one continuous conversation. **Note:** This endpoint is currently in beta and might be subject to changes. * @summary Create a Genie session * @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 createGenieSession(idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createGenieSession(idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['GenieBetaApi.createGenieSession']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Sends a question to Genie and returns a single answer. Reuse the `sessionId` from the original session on follow-up messages to continue the conversation with prior context. **Note:** This endpoint is currently in beta and might be subject to changes. * @summary Send a message to a Genie session * @param {GenieSendMessageRequest} genieSendMessageRequest * @param {string} sessionId The Genie session ID returned from `POST /genie/sessions`. * @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 sendGenieMessage(genieSendMessageRequest: GenieSendMessageRequest, sessionId: string, idempotencyKey?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.sendGenieMessage(genieSendMessageRequest, sessionId, idempotencyKey, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['GenieBetaApi.sendGenieMessage']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * GenieBetaApi - factory interface * @export */ export const GenieBetaApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = GenieBetaApiFp(configuration) return { /** * Starts a new conversation with Genie, the Fireblocks AI assistant. Returns a `sessionId` — pass it when sending messages, and reuse it across calls to keep one continuous conversation. **Note:** This endpoint is currently in beta and might be subject to changes. * @summary Create a Genie session * @param {GenieBetaApiCreateGenieSessionRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createGenieSession(requestParameters: GenieBetaApiCreateGenieSessionRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.createGenieSession(requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, /** * Sends a question to Genie and returns a single answer. Reuse the `sessionId` from the original session on follow-up messages to continue the conversation with prior context. **Note:** This endpoint is currently in beta and might be subject to changes. * @summary Send a message to a Genie session * @param {GenieBetaApiSendGenieMessageRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ sendGenieMessage(requestParameters: GenieBetaApiSendGenieMessageRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.sendGenieMessage(requestParameters.genieSendMessageRequest, requestParameters.sessionId, requestParameters.idempotencyKey, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for createGenieSession operation in GenieBetaApi. * @export * @interface GenieBetaApiCreateGenieSessionRequest */ export interface GenieBetaApiCreateGenieSessionRequest { /** * 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 GenieBetaApiCreateGenieSession */ readonly idempotencyKey?: string } /** * Request parameters for sendGenieMessage operation in GenieBetaApi. * @export * @interface GenieBetaApiSendGenieMessageRequest */ export interface GenieBetaApiSendGenieMessageRequest { /** * * @type {GenieSendMessageRequest} * @memberof GenieBetaApiSendGenieMessage */ readonly genieSendMessageRequest: GenieSendMessageRequest /** * The Genie session ID returned from `POST /genie/sessions`. * @type {string} * @memberof GenieBetaApiSendGenieMessage */ readonly sessionId: 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 GenieBetaApiSendGenieMessage */ readonly idempotencyKey?: string } /** * GenieBetaApi - object-oriented interface * @export * @class GenieBetaApi * @extends {BaseAPI} */ export class GenieBetaApi extends BaseAPI { /** * Starts a new conversation with Genie, the Fireblocks AI assistant. Returns a `sessionId` — pass it when sending messages, and reuse it across calls to keep one continuous conversation. **Note:** This endpoint is currently in beta and might be subject to changes. * @summary Create a Genie session * @param {GenieBetaApiCreateGenieSessionRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof GenieBetaApi */ public createGenieSession(requestParameters: GenieBetaApiCreateGenieSessionRequest = {}) { return GenieBetaApiFp(this.configuration).createGenieSession(requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } /** * Sends a question to Genie and returns a single answer. Reuse the `sessionId` from the original session on follow-up messages to continue the conversation with prior context. **Note:** This endpoint is currently in beta and might be subject to changes. * @summary Send a message to a Genie session * @param {GenieBetaApiSendGenieMessageRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof GenieBetaApi */ public sendGenieMessage(requestParameters: GenieBetaApiSendGenieMessageRequest) { return GenieBetaApiFp(this.configuration).sendGenieMessage(requestParameters.genieSendMessageRequest, requestParameters.sessionId, requestParameters.idempotencyKey).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } }