/* tslint:disable */ /* eslint-disable */ /** * ChatGPT Function * Backend for Azure OpenAI integrations * * The version of the OpenAPI document: v1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { AzureBlobStorageCredentials, EmailContentResponse, ErrorResponse, FollowUpEmailResponse, InputChatMessage, RealtimeAgentsDto, RealtimeSession, SimpleResponseDto, SlackEvent, } from '../models/index'; import { AzureBlobStorageCredentialsFromJSON, AzureBlobStorageCredentialsToJSON, EmailContentResponseFromJSON, EmailContentResponseToJSON, ErrorResponseFromJSON, ErrorResponseToJSON, FollowUpEmailResponseFromJSON, FollowUpEmailResponseToJSON, InputChatMessageFromJSON, InputChatMessageToJSON, RealtimeAgentsDtoFromJSON, RealtimeAgentsDtoToJSON, RealtimeSessionFromJSON, RealtimeSessionToJSON, SimpleResponseDtoFromJSON, SimpleResponseDtoToJSON, SlackEventFromJSON, SlackEventToJSON, } from '../models/index'; export interface AsyncConversationRequest { inputChatMessage: Array; addDefaultPrompts?: boolean; addApiTools?: boolean; } export interface AsyncQuestionRequest { input: string; addDefaultPrompts?: boolean; addApiTools?: boolean; } export interface GenerateFollowUpEmailRequest { companyName: string; } export interface GenerateFollowUpEmailByContactRequest { contactId: string; } export interface GenerateFollowUpEmailByContactGetRequest { contactId: string; } export interface GenerateFollowUpEmailGetRequest { companyName: string; } export interface GetEphemeralTokenRequest { agent?: string; voice?: string; } export interface GetSingleNewsRequest { topic?: string; } export interface ProtectedAsyncConversationRequest { inputChatMessage: Array; addDefaultPrompts?: boolean; addApiTools?: boolean; } export interface ProtectedAsyncQuestionRequest { input: string; addDefaultPrompts?: boolean; addApiTools?: boolean; } export interface ProtectedSyncConversationRequest { inputChatMessage: Array; addDefaultPrompts?: boolean; addApiTools?: boolean; } export interface ProtectedSyncQuestionRequest { input: string; addDefaultPrompts?: boolean; addApiTools?: boolean; } export interface SlackEventRequest { slackEvent: SlackEvent; } export interface SummarizeNewsletterRequest { topic?: string; } export interface SyncConversationRequest { inputChatMessage: Array; addDefaultPrompts?: boolean; addApiTools?: boolean; } export interface SyncQuestionRequest { input: string; addDefaultPrompts?: boolean; addApiTools?: boolean; } /** * */ export class ChatGptClient extends runtime.BaseAPI { /** * This function asynchronously handles a conversation using ChatGPT. * Asynchronously handle a conversation using ChatGPT */ async asyncConversationRaw(requestParameters: AsyncConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['inputChatMessage'] == null) { throw new runtime.RequiredError( 'inputChatMessage', 'Required parameter "inputChatMessage" was null or undefined when calling asyncConversation().' ); } const queryParameters: any = {}; if (requestParameters['addDefaultPrompts'] != null) { queryParameters['addDefaultPrompts'] = requestParameters['addDefaultPrompts']; } if (requestParameters['addApiTools'] != null) { queryParameters['addApiTools'] = requestParameters['addApiTools']; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; let urlPath = `/v1.0/conversation/async`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['inputChatMessage']!.map(InputChatMessageToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * This function asynchronously handles a conversation using ChatGPT. * Asynchronously handle a conversation using ChatGPT */ async asyncConversation(requestParameters: AsyncConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.asyncConversationRaw(requestParameters, initOverrides); } /** * This function asynchronously answers a question using ChatGPT. * Asynchronously answer a question using ChatGPT */ async asyncQuestionRaw(requestParameters: AsyncQuestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['input'] == null) { throw new runtime.RequiredError( 'input', 'Required parameter "input" was null or undefined when calling asyncQuestion().' ); } const queryParameters: any = {}; if (requestParameters['input'] != null) { queryParameters['input'] = requestParameters['input']; } if (requestParameters['addDefaultPrompts'] != null) { queryParameters['addDefaultPrompts'] = requestParameters['addDefaultPrompts']; } if (requestParameters['addApiTools'] != null) { queryParameters['addApiTools'] = requestParameters['addApiTools']; } const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/v1.0/question/async`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * This function asynchronously answers a question using ChatGPT. * Asynchronously answer a question using ChatGPT */ async asyncQuestion(requestParameters: AsyncQuestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.asyncQuestionRaw(requestParameters, initOverrides); } /** * Generates a personalized follow-up email using Salesforce data and external research * Generate a follow-up email for a company, and save it as a draft in the pre-configured mailbox */ async generateFollowUpEmailRaw(requestParameters: GenerateFollowUpEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['companyName'] == null) { throw new runtime.RequiredError( 'companyName', 'Required parameter "companyName" was null or undefined when calling generateFollowUpEmail().' ); } const queryParameters: any = {}; if (requestParameters['companyName'] != null) { queryParameters['companyName'] = requestParameters['companyName']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("Implicit", ["api://f0d0b6e5-864f-46ef-9883-ca776230a6aa/user_impersonation"]); } let urlPath = `/followup-email`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FollowUpEmailResponseFromJSON(jsonValue)); } /** * Generates a personalized follow-up email using Salesforce data and external research * Generate a follow-up email for a company, and save it as a draft in the pre-configured mailbox */ async generateFollowUpEmail(requestParameters: GenerateFollowUpEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.generateFollowUpEmailRaw(requestParameters, initOverrides); return await response.value(); } /** * Generates a personalized follow-up email using Salesforce contact data and external research. No email will be sent automatically, but the email will be saved as a draft. * Generate a follow-up email for a specific contact, and save it as a draft in the pre-configured mailbox */ async generateFollowUpEmailByContactRaw(requestParameters: GenerateFollowUpEmailByContactRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['contactId'] == null) { throw new runtime.RequiredError( 'contactId', 'Required parameter "contactId" was null or undefined when calling generateFollowUpEmailByContact().' ); } const queryParameters: any = {}; if (requestParameters['contactId'] != null) { queryParameters['contactId'] = requestParameters['contactId']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("Implicit", ["api://f0d0b6e5-864f-46ef-9883-ca776230a6aa/user_impersonation"]); } let urlPath = `/followup-email/contact`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => FollowUpEmailResponseFromJSON(jsonValue)); } /** * Generates a personalized follow-up email using Salesforce contact data and external research. No email will be sent automatically, but the email will be saved as a draft. * Generate a follow-up email for a specific contact, and save it as a draft in the pre-configured mailbox */ async generateFollowUpEmailByContact(requestParameters: GenerateFollowUpEmailByContactRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.generateFollowUpEmailByContactRaw(requestParameters, initOverrides); return await response.value(); } /** * Generates personalized follow-up email content using Salesforce contact data and external research. Returns the email content without creating a draft. * Generate follow-up email content for a specific contact */ async generateFollowUpEmailByContactGetRaw(requestParameters: GenerateFollowUpEmailByContactGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['contactId'] == null) { throw new runtime.RequiredError( 'contactId', 'Required parameter "contactId" was null or undefined when calling generateFollowUpEmailByContactGet().' ); } const queryParameters: any = {}; if (requestParameters['contactId'] != null) { queryParameters['contactId'] = requestParameters['contactId']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("Implicit", ["api://f0d0b6e5-864f-46ef-9883-ca776230a6aa/user_impersonation"]); } let urlPath = `/followup-email/contact`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EmailContentResponseFromJSON(jsonValue)); } /** * Generates personalized follow-up email content using Salesforce contact data and external research. Returns the email content without creating a draft. * Generate follow-up email content for a specific contact */ async generateFollowUpEmailByContactGet(requestParameters: GenerateFollowUpEmailByContactGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.generateFollowUpEmailByContactGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Generates personalized follow-up email content using Salesforce data and external research. Returns the email content without creating a draft. * Generate follow-up email content for a company */ async generateFollowUpEmailGetRaw(requestParameters: GenerateFollowUpEmailGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['companyName'] == null) { throw new runtime.RequiredError( 'companyName', 'Required parameter "companyName" was null or undefined when calling generateFollowUpEmailGet().' ); } const queryParameters: any = {}; if (requestParameters['companyName'] != null) { queryParameters['companyName'] = requestParameters['companyName']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("Implicit", ["api://f0d0b6e5-864f-46ef-9883-ca776230a6aa/user_impersonation"]); } let urlPath = `/followup-email`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EmailContentResponseFromJSON(jsonValue)); } /** * Generates personalized follow-up email content using Salesforce data and external research. Returns the email content without creating a draft. * Generate follow-up email content for a company */ async generateFollowUpEmailGet(requestParameters: GenerateFollowUpEmailGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.generateFollowUpEmailGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Lists all predefined context modes for GPT-4o realtime sessions * List all available contexts */ async getAvailableAgentsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/v1.0/realtime/agents`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(RealtimeAgentsDtoFromJSON)); } /** * Lists all predefined context modes for GPT-4o realtime sessions * List all available contexts */ async getAvailableAgents(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getAvailableAgentsRaw(initOverrides); return await response.value(); } /** * Generates a sas token for use to upload image and video memories to azure blob storage * Gets blob storage and creates sas token */ async getBlobStorageRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/v1.0/public/blob-storage`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => AzureBlobStorageCredentialsFromJSON(jsonValue)); } /** * Generates a sas token for use to upload image and video memories to azure blob storage * Gets blob storage and creates sas token */ async getBlobStorage(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getBlobStorageRaw(initOverrides); return await response.value(); } /** * Starts a new ephemeral realtime session with OpenAI GPT-4o. Use `agent` query param to switch assistant behavior. * Get ephemeral token for GPT-4o realtime session */ async getEphemeralTokenRaw(requestParameters: GetEphemeralTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (requestParameters['agent'] != null) { queryParameters['agent'] = requestParameters['agent']; } if (requestParameters['voice'] != null) { queryParameters['voice'] = requestParameters['voice']; } const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/v1.0/realtime/get-ephemeral-token`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RealtimeSessionFromJSON(jsonValue)); } /** * Starts a new ephemeral realtime session with OpenAI GPT-4o. Use `agent` query param to switch assistant behavior. * Get ephemeral token for GPT-4o realtime session */ async getEphemeralToken(requestParameters: GetEphemeralTokenRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getEphemeralTokenRaw(requestParameters, initOverrides); return await response.value(); } /** * Fetches one AI news item from recent emails * Get a single AI news item */ async getSingleNewsRaw(requestParameters: GetSingleNewsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (requestParameters['topic'] != null) { queryParameters['topic'] = requestParameters['topic']; } const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/v1.0/newsletter/single-news`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SimpleResponseDtoFromJSON(jsonValue)); } /** * Fetches one AI news item from recent emails * Get a single AI news item */ async getSingleNews(requestParameters: GetSingleNewsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getSingleNewsRaw(requestParameters, initOverrides); return await response.value(); } /** * This function asynchronously handles a conversation using ChatGPT. * Asynchronously handle a conversation using ChatGPT */ async protectedAsyncConversationRaw(requestParameters: ProtectedAsyncConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['inputChatMessage'] == null) { throw new runtime.RequiredError( 'inputChatMessage', 'Required parameter "inputChatMessage" was null or undefined when calling protectedAsyncConversation().' ); } const queryParameters: any = {}; if (requestParameters['addDefaultPrompts'] != null) { queryParameters['addDefaultPrompts'] = requestParameters['addDefaultPrompts']; } if (requestParameters['addApiTools'] != null) { queryParameters['addApiTools'] = requestParameters['addApiTools']; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("Implicit", ["api://f0d0b6e5-864f-46ef-9883-ca776230a6aa/user_impersonation"]); } let urlPath = `/v1.0/protected/conversation/async`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['inputChatMessage']!.map(InputChatMessageToJSON), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * This function asynchronously handles a conversation using ChatGPT. * Asynchronously handle a conversation using ChatGPT */ async protectedAsyncConversation(requestParameters: ProtectedAsyncConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.protectedAsyncConversationRaw(requestParameters, initOverrides); } /** * This function asynchronously answers a question using ChatGPT. * Asynchronously answer a question using ChatGPT */ async protectedAsyncQuestionRaw(requestParameters: ProtectedAsyncQuestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['input'] == null) { throw new runtime.RequiredError( 'input', 'Required parameter "input" was null or undefined when calling protectedAsyncQuestion().' ); } const queryParameters: any = {}; if (requestParameters['input'] != null) { queryParameters['input'] = requestParameters['input']; } if (requestParameters['addDefaultPrompts'] != null) { queryParameters['addDefaultPrompts'] = requestParameters['addDefaultPrompts']; } if (requestParameters['addApiTools'] != null) { queryParameters['addApiTools'] = requestParameters['addApiTools']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("Implicit", ["api://f0d0b6e5-864f-46ef-9883-ca776230a6aa/user_impersonation"]); } let urlPath = `/v1.0/protected/question/async`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * This function asynchronously answers a question using ChatGPT. * Asynchronously answer a question using ChatGPT */ async protectedAsyncQuestion(requestParameters: ProtectedAsyncQuestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.protectedAsyncQuestionRaw(requestParameters, initOverrides); } /** * This function synchronously handles a conversation using ChatGPT. * Synchronously handle a conversation using ChatGPT */ async protectedSyncConversationRaw(requestParameters: ProtectedSyncConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['inputChatMessage'] == null) { throw new runtime.RequiredError( 'inputChatMessage', 'Required parameter "inputChatMessage" was null or undefined when calling protectedSyncConversation().' ); } const queryParameters: any = {}; if (requestParameters['addDefaultPrompts'] != null) { queryParameters['addDefaultPrompts'] = requestParameters['addDefaultPrompts']; } if (requestParameters['addApiTools'] != null) { queryParameters['addApiTools'] = requestParameters['addApiTools']; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("Implicit", ["api://f0d0b6e5-864f-46ef-9883-ca776230a6aa/user_impersonation"]); } let urlPath = `/v1.0/protected/conversation`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['inputChatMessage']!.map(InputChatMessageToJSON), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SimpleResponseDtoFromJSON(jsonValue)); } /** * This function synchronously handles a conversation using ChatGPT. * Synchronously handle a conversation using ChatGPT */ async protectedSyncConversation(requestParameters: ProtectedSyncConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.protectedSyncConversationRaw(requestParameters, initOverrides); return await response.value(); } /** * This function synchronously answers a question using ChatGPT. * Synchronously answer a question using ChatGPT */ async protectedSyncQuestionRaw(requestParameters: ProtectedSyncQuestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['input'] == null) { throw new runtime.RequiredError( 'input', 'Required parameter "input" was null or undefined when calling protectedSyncQuestion().' ); } const queryParameters: any = {}; if (requestParameters['input'] != null) { queryParameters['input'] = requestParameters['input']; } if (requestParameters['addDefaultPrompts'] != null) { queryParameters['addDefaultPrompts'] = requestParameters['addDefaultPrompts']; } if (requestParameters['addApiTools'] != null) { queryParameters['addApiTools'] = requestParameters['addApiTools']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { // oauth required headerParameters["Authorization"] = await this.configuration.accessToken("Implicit", ["api://f0d0b6e5-864f-46ef-9883-ca776230a6aa/user_impersonation"]); } let urlPath = `/v1.0/protected/question`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SimpleResponseDtoFromJSON(jsonValue)); } /** * This function synchronously answers a question using ChatGPT. * Synchronously answer a question using ChatGPT */ async protectedSyncQuestion(requestParameters: ProtectedSyncQuestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.protectedSyncQuestionRaw(requestParameters, initOverrides); return await response.value(); } /** * This function handles a Slack event. * Handle a Slack event */ async slackEventRaw(requestParameters: SlackEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['slackEvent'] == null) { throw new runtime.RequiredError( 'slackEvent', 'Required parameter "slackEvent" was null or undefined when calling slackEvent().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; let urlPath = `/v1.0/slack/event`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: SlackEventToJSON(requestParameters['slackEvent']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SlackEventFromJSON(jsonValue)); } /** * This function handles a Slack event. * Handle a Slack event */ async slackEvent(requestParameters: SlackEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.slackEventRaw(requestParameters, initOverrides); switch (response.raw.status) { case 200: return await response.value(); case 204: return null; default: return await response.value(); } } /** * Reads last week\'s newsletter mails and returns summary * Summarize newsletter of a given topic */ async summarizeNewsletterRaw(requestParameters: SummarizeNewsletterRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (requestParameters['topic'] != null) { queryParameters['topic'] = requestParameters['topic']; } const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/v1.0/newsletter/summary`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SimpleResponseDtoFromJSON(jsonValue)); } /** * Reads last week\'s newsletter mails and returns summary * Summarize newsletter of a given topic */ async summarizeNewsletter(requestParameters: SummarizeNewsletterRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.summarizeNewsletterRaw(requestParameters, initOverrides); return await response.value(); } /** * This function synchronously handles a conversation using ChatGPT. * Synchronously handle a conversation using ChatGPT */ async syncConversationRaw(requestParameters: SyncConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['inputChatMessage'] == null) { throw new runtime.RequiredError( 'inputChatMessage', 'Required parameter "inputChatMessage" was null or undefined when calling syncConversation().' ); } const queryParameters: any = {}; if (requestParameters['addDefaultPrompts'] != null) { queryParameters['addDefaultPrompts'] = requestParameters['addDefaultPrompts']; } if (requestParameters['addApiTools'] != null) { queryParameters['addApiTools'] = requestParameters['addApiTools']; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; let urlPath = `/v1.0/conversation`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['inputChatMessage']!.map(InputChatMessageToJSON), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SimpleResponseDtoFromJSON(jsonValue)); } /** * This function synchronously handles a conversation using ChatGPT. * Synchronously handle a conversation using ChatGPT */ async syncConversation(requestParameters: SyncConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.syncConversationRaw(requestParameters, initOverrides); return await response.value(); } /** * This function synchronously answers a question using ChatGPT. * Synchronously answer a question using ChatGPT */ async syncQuestionRaw(requestParameters: SyncQuestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['input'] == null) { throw new runtime.RequiredError( 'input', 'Required parameter "input" was null or undefined when calling syncQuestion().' ); } const queryParameters: any = {}; if (requestParameters['input'] != null) { queryParameters['input'] = requestParameters['input']; } if (requestParameters['addDefaultPrompts'] != null) { queryParameters['addDefaultPrompts'] = requestParameters['addDefaultPrompts']; } if (requestParameters['addApiTools'] != null) { queryParameters['addApiTools'] = requestParameters['addApiTools']; } const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/v1.0/question`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SimpleResponseDtoFromJSON(jsonValue)); } /** * This function synchronously answers a question using ChatGPT. * Synchronously answer a question using ChatGPT */ async syncQuestion(requestParameters: SyncQuestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.syncQuestionRaw(requestParameters, initOverrides); return await response.value(); } }