@superoffice/webapi 11.7.727 → 11.8.788

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/LICENSE.md +15 -15
  2. package/README.md +184 -184
  3. package/__tests__/Appointment63-notz.json +1925 -1925
  4. package/__tests__/Appointment63-utctz.json +1925 -1925
  5. package/__tests__/Appointment63.json +1925 -1925
  6. package/__tests__/AppointmentTzTest.ts +115 -115
  7. package/__tests__/AxiosNockTest.ts +28 -28
  8. package/__tests__/ContactDefault.json +699 -699
  9. package/__tests__/ContactEntity.json +272 -272
  10. package/__tests__/ContactRestTest.ts +144 -144
  11. package/__tests__/ContactTest.ts +395 -395
  12. package/__tests__/ConvertersTest.ts +97 -97
  13. package/__tests__/DocumentTest.ts +101 -101
  14. package/__tests__/Person210-notz.json +1932 -1932
  15. package/__tests__/Person210-utctz.json +1932 -1932
  16. package/__tests__/Person210.json +1932 -1932
  17. package/__tests__/PersonImageData.nock +22 -22
  18. package/__tests__/PersonTest.ts +41 -41
  19. package/__tests__/PersonTzTest.ts +113 -113
  20. package/__tests__/RecurrenceInfo.json +55 -55
  21. package/__tests__/ResponseCallbackTest.ts +23 -23
  22. package/__tests__/TableRights.json +441 -441
  23. package/__tests__/WebapiTest.ts +264 -264
  24. package/__tests__/Webhook.json +16 -16
  25. package/__tests__/WebhookTest.ts +209 -209
  26. package/dist/cjs/Carriers.d.ts +367 -4
  27. package/dist/cjs/Carriers.d.ts.map +1 -1
  28. package/dist/cjs/Converters.d.ts +9 -0
  29. package/dist/cjs/Converters.d.ts.map +1 -1
  30. package/dist/cjs/Converters.js +185 -17
  31. package/dist/cjs/Converters.js.map +1 -1
  32. package/dist/cjs/DiagnosticsAgent.d.ts +38 -0
  33. package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
  34. package/dist/cjs/DiagnosticsAgent.js +91 -0
  35. package/dist/cjs/DiagnosticsAgent.js.map +1 -1
  36. package/dist/cjs/Enums.d.ts +18 -0
  37. package/dist/cjs/Enums.d.ts.map +1 -1
  38. package/dist/cjs/Enums.js +20 -1
  39. package/dist/cjs/Enums.js.map +1 -1
  40. package/dist/cjs/ListAgent.d.ts +71 -6
  41. package/dist/cjs/ListAgent.d.ts.map +1 -1
  42. package/dist/cjs/ListAgent.js +157 -0
  43. package/dist/cjs/ListAgent.js.map +1 -1
  44. package/dist/cjs/TicketAgent.d.ts +23 -0
  45. package/dist/cjs/TicketAgent.d.ts.map +1 -1
  46. package/dist/cjs/TicketAgent.js +65 -0
  47. package/dist/cjs/TicketAgent.js.map +1 -1
  48. package/dist/esm/Carriers.d.ts +367 -4
  49. package/dist/esm/Carriers.d.ts.map +1 -1
  50. package/dist/esm/Converters.d.ts +9 -0
  51. package/dist/esm/Converters.d.ts.map +1 -1
  52. package/dist/esm/Converters.js +159 -0
  53. package/dist/esm/Converters.js.map +1 -1
  54. package/dist/esm/DiagnosticsAgent.d.ts +38 -0
  55. package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
  56. package/dist/esm/DiagnosticsAgent.js +91 -0
  57. package/dist/esm/DiagnosticsAgent.js.map +1 -1
  58. package/dist/esm/Enums.d.ts +18 -0
  59. package/dist/esm/Enums.d.ts.map +1 -1
  60. package/dist/esm/Enums.js +19 -0
  61. package/dist/esm/Enums.js.map +1 -1
  62. package/dist/esm/ListAgent.d.ts +71 -6
  63. package/dist/esm/ListAgent.d.ts.map +1 -1
  64. package/dist/esm/ListAgent.js +157 -0
  65. package/dist/esm/ListAgent.js.map +1 -1
  66. package/dist/esm/TicketAgent.d.ts +23 -0
  67. package/dist/esm/TicketAgent.d.ts.map +1 -1
  68. package/dist/esm/TicketAgent.js +65 -0
  69. package/dist/esm/TicketAgent.js.map +1 -1
  70. package/examples-js/hello.js +12 -12
  71. package/examples-ts/hello.ts +8 -8
  72. package/package.json +93 -93
  73. package/scripts/postbuild.js +22 -22
  74. package/scripts/setVersion.js +44 -44
  75. package/src/AIAgent.ts +1992 -1992
  76. package/src/AppointmentAgent.ts +6263 -6263
  77. package/src/AppointmentRestApi.ts +225 -225
  78. package/src/ArchiveAgent.ts +1950 -1950
  79. package/src/AssociateAgent.ts +422 -422
  80. package/src/AxiosCacheHandler.ts +74 -74
  81. package/src/BLOBAgent.ts +2100 -2100
  82. package/src/Base64.ts +285 -285
  83. package/src/BatchAgent.ts +910 -910
  84. package/src/BulkUpdateAgent.ts +504 -504
  85. package/src/CRMScriptAgent.ts +1390 -1390
  86. package/src/Carriers.ts +52750 -52274
  87. package/src/ChatAgent.ts +1422 -1422
  88. package/src/ConfigurationAgent.ts +2228 -2228
  89. package/src/ContactAgent.ts +1756 -1756
  90. package/src/ContactRestApi.ts +237 -237
  91. package/src/Converters.ts +23271 -23090
  92. package/src/CustomerServiceAgent.ts +1799 -1799
  93. package/src/DashAgent.ts +1674 -1674
  94. package/src/DatabaseAgent.ts +120 -120
  95. package/src/DatabaseTableAgent.ts +534 -534
  96. package/src/Day_js.ts +41 -41
  97. package/src/DiagnosticsAgent.ts +1384 -1240
  98. package/src/DocumentAgent.ts +5079 -5079
  99. package/src/DocumentMigrationAgent.ts +524 -524
  100. package/src/DocumentRestApi.ts +259 -259
  101. package/src/EMailAgent.ts +5328 -5328
  102. package/src/Enums.ts +6936 -6916
  103. package/src/ErpSyncAgent.ts +2658 -2658
  104. package/src/FavouriteAgent.ts +720 -720
  105. package/src/FindAgent.ts +2330 -2330
  106. package/src/ForeignSystemAgent.ts +1710 -1710
  107. package/src/FreeTextAgent.ts +372 -372
  108. package/src/ImportAgent.ts +304 -304
  109. package/src/LicenseAgent.ts +1230 -1230
  110. package/src/ListAgent.ts +11451 -11237
  111. package/src/MDOAgent.ts +748 -748
  112. package/src/MarketingAgent.ts +890 -890
  113. package/src/MessagingAgent.ts +384 -384
  114. package/src/NavigatorAgent.ts +140 -140
  115. package/src/NumberAllocationAgent.ts +296 -296
  116. package/src/PersonAgent.ts +3287 -3287
  117. package/src/PersonRestApi.ts +241 -241
  118. package/src/PhoneListAgent.ts +458 -458
  119. package/src/PocketAgent.ts +780 -780
  120. package/src/PreferenceAgent.ts +1900 -1900
  121. package/src/PreviewsAgent.ts +116 -116
  122. package/src/ProjectAgent.ts +2391 -2391
  123. package/src/ProjectRestApi.ts +239 -239
  124. package/src/QuoteAgent.ts +5159 -5159
  125. package/src/RelationAgent.ts +220 -220
  126. package/src/ReportAgent.ts +154 -154
  127. package/src/ResourceAgent.ts +358 -358
  128. package/src/SaintAgent.ts +601 -601
  129. package/src/SaleAgent.ts +2034 -2034
  130. package/src/SaleRestApi.ts +233 -233
  131. package/src/SelectionAgent.ts +3195 -3195
  132. package/src/SentryAgent.ts +462 -462
  133. package/src/SoApiConstants.ts +8 -8
  134. package/src/TargetsAgent.ts +1104 -1104
  135. package/src/TicketAgent.ts +3708 -3638
  136. package/src/TimeZoneAgent.ts +528 -528
  137. package/src/TooltipsAgent.ts +116 -116
  138. package/src/UserAgent.ts +4856 -4856
  139. package/src/UserDefinedFieldInfoAgent.ts +1764 -1764
  140. package/src/ViewStateAgent.ts +858 -858
  141. package/src/WebApi.ts +872 -872
  142. package/src/WebApiBase.ts +565 -565
  143. package/src/WebhookAgent.ts +388 -388
  144. package/src/WorkflowAgent.ts +1338 -1338
  145. package/tsconfig.esm.json +8 -8
  146. package/tsconfig.jest.json +8 -8
  147. package/tsconfig.json +34 -34
package/src/AIAgent.ts CHANGED
@@ -1,1992 +1,1992 @@
1
- // <auto-generated>
2
- // SuperOffice Code Generator
3
- // modelling\templates\servicestswebapi\tswebapiagents.tt
4
- // </auto-generated>
5
-
6
-
7
- /* tslint:disable */
8
- //----------------------------------------------------------------------------
9
- // G E N E R A T E D F I L E ! D O N O T E D I T !
10
- //----------------------------------------------------------------------------
11
- //
12
- // File: WebApi/AIAgent.ts
13
- //
14
- //----------------------------------------------------------------------------
15
- // Copyright (C) SuperOffice AS
16
- //----------------------------------------------------------------------------
17
-
18
- import { AxiosRequestConfig } from 'axios';
19
- import { Duration } from 'dayjs/plugin/duration';
20
- import * as enums from './Enums';
21
- import * as base from './WebApiBase';
22
- import * as carriers from './Carriers';
23
- import * as converters from './Converters';
24
- import { FromBase64ToString, ToBase64 } from './Base64';
25
-
26
- /**
27
- * AI services, such as Translation, Statistics, Sentiment analysis, backed by calls to Public Cloud providers
28
- */
29
- export interface IAIAgent {
30
- createDefaultCopilotDataSourceEntityAsync(): Promise< carriers.CopilotDataSourceEntity >;
31
- saveCopilotDataSourceEntityAsync(entity: carriers.CopilotDataSourceEntity) : Promise< carriers.CopilotDataSourceEntity >;
32
- deleteCopilotDataSourceEntityAsync(CopilotDataSourceEntityId: number) : Promise<void>;
33
- createDefaultCopilotEntityAsync(): Promise< carriers.CopilotEntity >;
34
- saveCopilotEntityAsync(entity: carriers.CopilotEntity) : Promise< carriers.CopilotEntity >;
35
- deleteCopilotEntityAsync(CopilotEntityId: number) : Promise<void>;
36
- summarizeTextAsync(request: carriers.AI_SummarizeTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
37
- summarizeTextAsync(text: string, percentSmaller: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
38
- expandTextAsync(request: carriers.AI_ExpandTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
39
- expandTextAsync(text: string, percentBigger: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
40
- rephraseTextAsync(request: carriers.AI_RephraseTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
41
- rephraseTextAsync(text: string, style: enums.AiTextStyle, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
42
- createTextForAppointmentAsync(request: carriers.AI_CreateTextForAppointmentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
43
- createTextForAppointmentAsync(appointment: carriers.AppointmentEntity, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
44
- analyzeBizCardImageAsync(request: carriers.AI_AnalyzeBizCardImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
45
- analyzeBizCardImageAsync(image: ArrayBuffer|string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
46
- analyzeBizCardTextAsync(request: carriers.AI_AnalyzeBizCardTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
47
- analyzeBizCardTextAsync(text: string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
48
- getTrainingStatusAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CategorizationStatusResponse >;
49
- guessCategoryAsync(request: carriers.AI_GuessCategoryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
50
- guessCategoryAsync(ticketId: number, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
51
- trainCategoryGuesserAsync(request: carriers.AI_TrainCategoryGuesserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
52
- trainCategoryGuesserAsync(selectionId: number, maxItems: number, maxTextLength: number, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
53
- getChatbotResponseAsync(request: carriers.AI_GetChatbotResponseRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
54
- getChatbotResponseAsync(chatId: string, isoLangCode: string, userPrompt: string, displayValue: string, previousTurns: carriers.ChatbotTurn[], apiUrl: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
55
- getChatbotPromptSuggestionsAsync(request: carriers.AI_GetChatbotPromptSuggestionsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
56
- getChatbotPromptSuggestionsAsync(isoLangCode: string, soProtocol: string, currentId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
57
- getChatbotTurnsAsync(request: carriers.AI_GetChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] >;
58
- getChatbotTurnsAsync(chatId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] >;
59
- clearChatbotTurnsAsync(request: carriers.AI_ClearChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
60
- clearChatbotTurnsAsync(chatId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
61
- getCopilotDataSourceEntityAsync(copilotDataSourceEntityId: number) : Promise< carriers.CopilotDataSourceEntity >;
62
- getCopilotEntityAsync(copilotEntityId: number) : Promise< carriers.CopilotEntity >;
63
- getFormDesignFromImageAsync(request: carriers.AI_GetFormDesignFromImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
64
- getFormDesignFromImageAsync(image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
65
- getFormDesignFromUrlAsync(request: carriers.AI_GetFormDesignFromUrlRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
66
- getFormDesignFromUrlAsync(url: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
67
- detectLanguageAsync(request: carriers.AI_DetectLanguageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
68
- detectLanguageAsync(text: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
69
- detectSentimentAsync(request: carriers.AI_DetectSentimentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment >;
70
- detectSentimentAsync(text: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment >;
71
- translateAsync(request: carriers.AI_TranslateRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
72
- translateAsync(text: string, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
73
- translateEntityAsync(request: carriers.AI_TranslateEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
74
- translateEntityAsync(entityName: string, entityId: number, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
75
- answerAsync(request: carriers.AI_AnswerRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
76
- answerAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
77
- answerFeedbackAsync(request: carriers.AI_AnswerFeedbackRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
78
- answerFeedbackAsync(trackingId: string, isThumbsUp: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
79
- answerAcceptedAsync(request: carriers.AI_AnswerAcceptedRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
80
- answerAcceptedAsync(trackingId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
81
- searchAsync(request: carriers.AI_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
82
- searchAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
83
- startRagIndexingAsync(request: carriers.AI_StartRagIndexingRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
84
- startRagIndexingAsync(namespaceName: string, sourceId: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
85
- summarizeTicketAsync(request: carriers.AI_SummarizeTicketRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
86
- summarizeTicketAsync(ticketId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
87
- getSummarizeTicketPromptAsync(request: carriers.AI_GetSummarizeTicketPromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
88
- getSummarizeTicketPromptAsync(ticketId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
89
- summarizeContactAsync(request: carriers.AI_SummarizeContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
90
- summarizeContactAsync(contactId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
91
- getSummarizeContactPromptAsync(request: carriers.AI_GetSummarizeContactPromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
92
- getSummarizeContactPromptAsync(contactId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
93
- summarizeSaleAsync(request: carriers.AI_SummarizeSaleRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
94
- summarizeSaleAsync(saleId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
95
- getSummarizeSalePromptAsync(request: carriers.AI_GetSummarizeSalePromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
96
- getSummarizeSalePromptAsync(saleId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
97
- } // interface IAIAgent
98
-
99
-
100
-
101
-
102
- /**
103
- * AI services, such as Translation, Statistics, Sentiment analysis, backed by calls to Public Cloud providers
104
- */
105
- export class AIAgent extends base.WebApiBase implements IAIAgent {
106
- constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
107
- constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
108
- constructor(baseUrl: string, resourceManager:any);
109
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
110
- constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
111
- constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
112
- constructor(options: base.WebApiOptions);
113
-
114
- constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
115
- langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
116
- langOrResourceOrRM?:string|base.ResourceParsing|any,
117
- cultureCode?: string,
118
- ) {
119
- const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
120
- options.basePath = "v1/Agents/AI/";
121
- super(options);
122
- }
123
-
124
-
125
-
126
- /**
127
- * Set default values into a new CopilotDataSourceEntity.
128
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
129
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
130
- * @returns A blank entity.
131
- */
132
- public async createDefaultCopilotDataSourceEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.CopilotDataSourceEntity > {
133
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
134
- base.WebApiBase.SetPending(options);
135
- return new Promise< carriers.CopilotDataSourceEntity >(async (resolve, reject) => {
136
- try {
137
- const response = await this._axios.post("CreateDefaultCopilotDataSourceEntity", null, config);
138
- base.WebApiBase.SetCompleted(options, response);
139
- const res : carriers.CopilotDataSourceEntity = converters.Create_CopilotDataSourceEntity_From( response.data );
140
- resolve(res);
141
- }
142
- catch( err ) {
143
- base.WebApiBase.HandleError(options, config, err);
144
- reject(err);
145
- }
146
- });
147
- }
148
- /**
149
- * Replace the existing CopilotDataSourceEntity or creates a new CopilotDataSourceEntity if the id parameter is empty
150
- * @param entity - The CopilotDataSourceEntity to be saved.
151
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
152
- * @returns New or updated CopilotDataSourceEntity
153
- */
154
- public async saveCopilotDataSourceEntityAsync(entity: carriers.CopilotDataSourceEntity, options?:base.WebApiRequestOptions) : Promise< carriers.CopilotDataSourceEntity > {
155
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
156
- base.WebApiBase.SetPending(options);
157
- return new Promise< carriers.CopilotDataSourceEntity >(async (resolve, reject) => {
158
- try {
159
- const response = await this._axios.post("SaveCopilotDataSourceEntity", entity, config);
160
- base.WebApiBase.SetCompleted(options, response);
161
- const res : carriers.CopilotDataSourceEntity = converters.Create_CopilotDataSourceEntity_From( response.data );
162
- resolve(res);
163
- }
164
- catch( err ) {
165
- base.WebApiBase.HandleError(options, config, err);
166
- reject(err);
167
- }
168
- });
169
- }
170
-
171
- /**
172
- * Deletes the CopilotDataSourceEntity
173
- * @param CopilotDataSourceEntityId - The id of the CopilotDataSourceEntity to be deleted.
174
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
175
- */
176
- public async deleteCopilotDataSourceEntityAsync(CopilotDataSourceEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
177
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
178
- base.WebApiBase.SetPending(options);
179
- return new Promise< void >(async (resolve, reject) => {
180
- try {
181
- const response = await this._axios.post("DeleteCopilotDataSourceEntity?CopilotDataSourceEntityId=" + CopilotDataSourceEntityId, null, config );
182
- base.WebApiBase.SetCompleted(options, response);
183
- const res = response.data;
184
- resolve(res);
185
- }
186
- catch( err ) {
187
- base.WebApiBase.HandleError(options, config, err);
188
- reject(err);
189
- }
190
- });
191
- }
192
-
193
- /**
194
- * Set default values into a new CopilotEntity.
195
- * NetServer calculates default values on the entity, which is required when creating/storing a new instance
196
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
197
- * @returns A blank entity.
198
- */
199
- public async createDefaultCopilotEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.CopilotEntity > {
200
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
201
- base.WebApiBase.SetPending(options);
202
- return new Promise< carriers.CopilotEntity >(async (resolve, reject) => {
203
- try {
204
- const response = await this._axios.post("CreateDefaultCopilotEntity", null, config);
205
- base.WebApiBase.SetCompleted(options, response);
206
- const res : carriers.CopilotEntity = converters.Create_CopilotEntity_From( response.data );
207
- resolve(res);
208
- }
209
- catch( err ) {
210
- base.WebApiBase.HandleError(options, config, err);
211
- reject(err);
212
- }
213
- });
214
- }
215
- /**
216
- * Replace the existing CopilotEntity or creates a new CopilotEntity if the id parameter is empty
217
- * @param entity - The CopilotEntity to be saved.
218
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
219
- * @returns New or updated CopilotEntity
220
- */
221
- public async saveCopilotEntityAsync(entity: carriers.CopilotEntity, options?:base.WebApiRequestOptions) : Promise< carriers.CopilotEntity > {
222
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
223
- base.WebApiBase.SetPending(options);
224
- return new Promise< carriers.CopilotEntity >(async (resolve, reject) => {
225
- try {
226
- const response = await this._axios.post("SaveCopilotEntity", entity, config);
227
- base.WebApiBase.SetCompleted(options, response);
228
- const res : carriers.CopilotEntity = converters.Create_CopilotEntity_From( response.data );
229
- resolve(res);
230
- }
231
- catch( err ) {
232
- base.WebApiBase.HandleError(options, config, err);
233
- reject(err);
234
- }
235
- });
236
- }
237
-
238
- /**
239
- * Deletes the CopilotEntity
240
- * @param CopilotEntityId - The id of the CopilotEntity to be deleted.
241
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
242
- */
243
- public async deleteCopilotEntityAsync(CopilotEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
244
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
245
- base.WebApiBase.SetPending(options);
246
- return new Promise< void >(async (resolve, reject) => {
247
- try {
248
- const response = await this._axios.post("DeleteCopilotEntity?CopilotEntityId=" + CopilotEntityId, null, config );
249
- base.WebApiBase.SetCompleted(options, response);
250
- const res = response.data;
251
- resolve(res);
252
- }
253
- catch( err ) {
254
- base.WebApiBase.HandleError(options, config, err);
255
- reject(err);
256
- }
257
- });
258
- }
259
-
260
- private async _summarizeTextAsync(request: carriers.AI_SummarizeTextRequest, options?:base.WebApiRequestOptions) : Promise< string > {
261
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
262
- base.WebApiBase.SetPending(options);
263
- return new Promise< string >(async (resolve, reject) => {
264
- try {
265
- config.baseURL = this._options.baseUrl;
266
- const response = await this._axios.post("SummarizeText", request , config);
267
- base.WebApiBase.SetCompleted(options, response);
268
- const res : string = response.data as string;
269
- resolve(res);
270
- }
271
- catch( err ) {
272
- base.WebApiBase.HandleError(options, config, err);
273
- reject(err);
274
- }
275
- });
276
- }
277
-
278
-
279
-
280
- /**
281
- * Generate a short summary of a text
282
- * @param request - Text, PercentSmaller, IsoLangCode
283
- * @returns Short summary of the text
284
- */
285
- public async summarizeTextAsync(request: carriers.AI_SummarizeTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
286
-
287
- /**
288
- * Generate a short summary of a text
289
- * @param text - Text to summarize
290
- * @param percentSmaller - How much to shorten.
291
- * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
292
- * @returns Short summary of the text
293
- */
294
- public async summarizeTextAsync(text: string, percentSmaller: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
295
-
296
- public async summarizeTextAsync(text:string|carriers.AI_SummarizeTextRequest, percentSmaller?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
297
- let _request : carriers.AI_SummarizeTextRequest = null;
298
- let _options : base.WebApiRequestOptions = null;
299
- const first : any = text;
300
- if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.percentSmaller)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
301
- {
302
- _request = text as carriers.AI_SummarizeTextRequest;
303
- _options = percentSmaller as base.WebApiRequestOptions;
304
- }
305
- else
306
- {
307
- _request = {
308
- text: text as string,
309
- percentSmaller: percentSmaller as number,
310
- isoLangCode: isoLangCode as string,
311
- };
312
- _options = webapi_options;
313
- }
314
- return this._summarizeTextAsync( _request, _options );
315
- }
316
-
317
-
318
- private async _expandTextAsync(request: carriers.AI_ExpandTextRequest, options?:base.WebApiRequestOptions) : Promise< string > {
319
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
320
- base.WebApiBase.SetPending(options);
321
- return new Promise< string >(async (resolve, reject) => {
322
- try {
323
- config.baseURL = this._options.baseUrl;
324
- const response = await this._axios.post("ExpandText", request , config);
325
- base.WebApiBase.SetCompleted(options, response);
326
- const res : string = response.data as string;
327
- resolve(res);
328
- }
329
- catch( err ) {
330
- base.WebApiBase.HandleError(options, config, err);
331
- reject(err);
332
- }
333
- });
334
- }
335
-
336
-
337
-
338
- /**
339
- * Generate a longer version of a text
340
- * @param request - Text, PercentBigger, IsoLangCode
341
- * @returns Expanded version of the text
342
- */
343
- public async expandTextAsync(request: carriers.AI_ExpandTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
344
-
345
- /**
346
- * Generate a longer version of a text
347
- * @param text - Text to embiggen
348
- * @param percentBigger - How much to embiggen.
349
- * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
350
- * @returns Expanded version of the text
351
- */
352
- public async expandTextAsync(text: string, percentBigger: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
353
-
354
- public async expandTextAsync(text:string|carriers.AI_ExpandTextRequest, percentBigger?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
355
- let _request : carriers.AI_ExpandTextRequest = null;
356
- let _options : base.WebApiRequestOptions = null;
357
- const first : any = text;
358
- if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.percentBigger)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
359
- {
360
- _request = text as carriers.AI_ExpandTextRequest;
361
- _options = percentBigger as base.WebApiRequestOptions;
362
- }
363
- else
364
- {
365
- _request = {
366
- text: text as string,
367
- percentBigger: percentBigger as number,
368
- isoLangCode: isoLangCode as string,
369
- };
370
- _options = webapi_options;
371
- }
372
- return this._expandTextAsync( _request, _options );
373
- }
374
-
375
-
376
- private async _rephraseTextAsync(request: carriers.AI_RephraseTextRequest, options?:base.WebApiRequestOptions) : Promise< string > {
377
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
378
- base.WebApiBase.SetPending(options);
379
- return new Promise< string >(async (resolve, reject) => {
380
- try {
381
- config.baseURL = this._options.baseUrl;
382
- const response = await this._axios.post("RephraseText", request , config);
383
- base.WebApiBase.SetCompleted(options, response);
384
- const res : string = response.data as string;
385
- resolve(res);
386
- }
387
- catch( err ) {
388
- base.WebApiBase.HandleError(options, config, err);
389
- reject(err);
390
- }
391
- });
392
- }
393
-
394
-
395
-
396
- /**
397
- * Generate a new version of a text
398
- * @param request - Text, Style, IsoLangCode
399
- * @returns New version of the text
400
- */
401
- public async rephraseTextAsync(request: carriers.AI_RephraseTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
402
-
403
- /**
404
- * Generate a new version of a text
405
- * @param text - Text to transform
406
- * @param style - New style to transform text into (Rephrase, Correct, Casual, Formal)
407
- * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
408
- * @returns New version of the text
409
- */
410
- public async rephraseTextAsync(text: string, style: enums.AiTextStyle, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
411
-
412
- public async rephraseTextAsync(text:string|carriers.AI_RephraseTextRequest, style?:enums.AiTextStyle|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
413
- let _request : carriers.AI_RephraseTextRequest = null;
414
- let _options : base.WebApiRequestOptions = null;
415
- const first : any = text;
416
- if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.style)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
417
- {
418
- _request = text as carriers.AI_RephraseTextRequest;
419
- _options = style as base.WebApiRequestOptions;
420
- }
421
- else
422
- {
423
- _request = {
424
- text: text as string,
425
- style: style as enums.AiTextStyle,
426
- isoLangCode: isoLangCode as string,
427
- };
428
- _options = webapi_options;
429
- }
430
- return this._rephraseTextAsync( _request, _options );
431
- }
432
-
433
-
434
- private async _createTextForAppointmentAsync(request: carriers.AI_CreateTextForAppointmentRequest, options?:base.WebApiRequestOptions) : Promise< string > {
435
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
436
- base.WebApiBase.SetPending(options);
437
- return new Promise< string >(async (resolve, reject) => {
438
- try {
439
- config.baseURL = this._options.baseUrl;
440
- const response = await this._axios.post("CreateTextForAppointment", request , config);
441
- base.WebApiBase.SetCompleted(options, response);
442
- const res : string = response.data as string;
443
- resolve(res);
444
- }
445
- catch( err ) {
446
- base.WebApiBase.HandleError(options, config, err);
447
- reject(err);
448
- }
449
- });
450
- }
451
-
452
-
453
-
454
- /**
455
- * Generate agenda text for an appointment based on appointment&apos;s company category, title, person, etc.
456
- * @param request - Appointment, IsoLangCode
457
- * @returns Agenda text in markdown format
458
- */
459
- public async createTextForAppointmentAsync(request: carriers.AI_CreateTextForAppointmentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
460
-
461
- /**
462
- * Generate agenda text for an appointment based on appointment&apos;s company category, title, person, etc.
463
- * @param appointment - The appointment object to generate text for.
464
- * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
465
- * @returns Agenda text in markdown format
466
- */
467
- public async createTextForAppointmentAsync(appointment: carriers.AppointmentEntity, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
468
-
469
- public async createTextForAppointmentAsync(appointment:carriers.AppointmentEntity|carriers.AI_CreateTextForAppointmentRequest, isoLangCode?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
470
- let _request : carriers.AI_CreateTextForAppointmentRequest = null;
471
- let _options : base.WebApiRequestOptions = null;
472
- const first : any = appointment;
473
- if( typeof( first ) === "object" && first && ( typeof(first.appointment)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
474
- {
475
- _request = appointment as carriers.AI_CreateTextForAppointmentRequest;
476
- _options = isoLangCode as base.WebApiRequestOptions;
477
- }
478
- else
479
- {
480
- _request = {
481
- appointment: appointment as carriers.AppointmentEntity,
482
- isoLangCode: isoLangCode as string,
483
- };
484
- _options = webapi_options;
485
- }
486
- return this._createTextForAppointmentAsync( _request, _options );
487
- }
488
-
489
-
490
- private async _analyzeBizCardImageAsync(request: carriers.AI_AnalyzeBizCardImageRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
491
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
492
- base.WebApiBase.SetPending(options);
493
- return new Promise< carriers.BizCard >(async (resolve, reject) => {
494
- try {
495
- config.baseURL = this._options.baseUrl;
496
- const response = await this._axios.post("AnalyzeBizCardImage", request , config);
497
- base.WebApiBase.SetCompleted(options, response);
498
- const res : carriers.BizCard = converters.Create_BizCard_From( response.data );
499
- resolve(res);
500
- }
501
- catch( err ) {
502
- base.WebApiBase.HandleError(options, config, err);
503
- reject(err);
504
- }
505
- });
506
- }
507
-
508
-
509
-
510
- /**
511
- * Returns contact and person information from an image. Merges results with matching database records if merge = true
512
- * @param request - Image, MergeWithDatabase
513
- * @returns Returns a Contact and a Person entity.
514
- */
515
- public async analyzeBizCardImageAsync(request: carriers.AI_AnalyzeBizCardImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
516
-
517
- /**
518
- * Returns contact and person information from an image. Merges results with matching database records if merge = true
519
- * @param image - Image data containg a business card
520
- * @param mergeWithDatabase - Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities.
521
- * @returns Returns a Contact and a Person entity.
522
- */
523
- public async analyzeBizCardImageAsync(image: ArrayBuffer|string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
524
-
525
- public async analyzeBizCardImageAsync(image:ArrayBuffer|string|carriers.AI_AnalyzeBizCardImageRequest, mergeWithDatabase?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
526
- let _request : carriers.AI_AnalyzeBizCardImageRequest = null;
527
- let _options : base.WebApiRequestOptions = null;
528
- const first : any = image;
529
- if( typeof( first ) === "object" && first && ( typeof(first.image)!='undefined' || typeof(first.mergeWithDatabase)!='undefined' ) )
530
- {
531
- _request = image as carriers.AI_AnalyzeBizCardImageRequest;
532
- _options = mergeWithDatabase as base.WebApiRequestOptions;
533
- }
534
- else
535
- {
536
- _request = {
537
- image: image as ArrayBuffer|string,
538
- mergeWithDatabase: mergeWithDatabase as boolean,
539
- };
540
- _options = webapi_options;
541
- }
542
- _request.image = ToBase64(_request.image);
543
- return this._analyzeBizCardImageAsync( _request, _options );
544
- }
545
-
546
-
547
- private async _analyzeBizCardTextAsync(request: carriers.AI_AnalyzeBizCardTextRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
548
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
549
- base.WebApiBase.SetPending(options);
550
- return new Promise< carriers.BizCard >(async (resolve, reject) => {
551
- try {
552
- config.baseURL = this._options.baseUrl;
553
- const response = await this._axios.post("AnalyzeBizCardText", request , config);
554
- base.WebApiBase.SetCompleted(options, response);
555
- const res : carriers.BizCard = converters.Create_BizCard_From( response.data );
556
- resolve(res);
557
- }
558
- catch( err ) {
559
- base.WebApiBase.HandleError(options, config, err);
560
- reject(err);
561
- }
562
- });
563
- }
564
-
565
-
566
-
567
- /**
568
- * Extract contact and person information from text. Merge results with matching database records if merge = true
569
- * @param request - Text, MergeWithDatabase
570
- * @returns Returns a Contact and a Person entity.
571
- */
572
- public async analyzeBizCardTextAsync(request: carriers.AI_AnalyzeBizCardTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
573
-
574
- /**
575
- * Extract contact and person information from text. Merge results with matching database records if merge = true
576
- * @param text - Text that contains useful contact and person information.
577
- * @param mergeWithDatabase - Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities.
578
- * @returns Returns a Contact and a Person entity.
579
- */
580
- public async analyzeBizCardTextAsync(text: string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
581
-
582
- public async analyzeBizCardTextAsync(text:string|carriers.AI_AnalyzeBizCardTextRequest, mergeWithDatabase?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
583
- let _request : carriers.AI_AnalyzeBizCardTextRequest = null;
584
- let _options : base.WebApiRequestOptions = null;
585
- const first : any = text;
586
- if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.mergeWithDatabase)!='undefined' ) )
587
- {
588
- _request = text as carriers.AI_AnalyzeBizCardTextRequest;
589
- _options = mergeWithDatabase as base.WebApiRequestOptions;
590
- }
591
- else
592
- {
593
- _request = {
594
- text: text as string,
595
- mergeWithDatabase: mergeWithDatabase as boolean,
596
- };
597
- _options = webapi_options;
598
- }
599
- return this._analyzeBizCardTextAsync( _request, _options );
600
- }
601
-
602
-
603
- private async _getTrainingStatusAsync( options?:base.WebApiRequestOptions) : Promise< carriers.CategorizationStatusResponse > {
604
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
605
- base.WebApiBase.SetPending(options);
606
- return new Promise< carriers.CategorizationStatusResponse >(async (resolve, reject) => {
607
- try {
608
- config.baseURL = this._options.baseUrl;
609
- const response = await this._axios.post("GetTrainingStatus", undefined , config);
610
- base.WebApiBase.SetCompleted(options, response);
611
- const res : carriers.CategorizationStatusResponse = converters.Create_CategorizationStatusResponse_From( response.data );
612
- resolve(res);
613
- }
614
- catch( err ) {
615
- base.WebApiBase.HandleError(options, config, err);
616
- reject(err);
617
- }
618
- });
619
- }
620
-
621
-
622
- /**
623
- * Calling the HugoAI endpoint to fetch the current training status.
624
- * @returns Carrier to describe the current status of HugoAI categorization
625
- */
626
- public async getTrainingStatusAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CategorizationStatusResponse >
627
- {
628
- return this._getTrainingStatusAsync(webapi_options);
629
- }
630
-
631
-
632
- private async _guessCategoryAsync(request: carriers.AI_GuessCategoryRequest, options?:base.WebApiRequestOptions) : Promise< number > {
633
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
634
- base.WebApiBase.SetPending(options);
635
- return new Promise< number >(async (resolve, reject) => {
636
- try {
637
- config.baseURL = this._options.baseUrl;
638
- const response = await this._axios.post("GuessCategory", request , config);
639
- base.WebApiBase.SetCompleted(options, response);
640
- const res : number = response.data as number;
641
- resolve(res);
642
- }
643
- catch( err ) {
644
- base.WebApiBase.HandleError(options, config, err);
645
- reject(err);
646
- }
647
- });
648
- }
649
-
650
-
651
-
652
- /**
653
- * Given a ticket&apos;s id, guess the ticket category it should be placed in. Currently this is based on the first message in the ticket
654
- * @param request - TicketId
655
- * @returns Suggested ticket category ID
656
- */
657
- public async guessCategoryAsync(request: carriers.AI_GuessCategoryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
658
-
659
- /**
660
- * Given a ticket&apos;s id, guess the ticket category it should be placed in. Currently this is based on the first message in the ticket
661
- * @param ticketId - Id of ticket to guess category for
662
- * @returns Suggested ticket category ID
663
- */
664
- public async guessCategoryAsync(ticketId: number, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
665
-
666
- public async guessCategoryAsync(ticketId:number|carriers.AI_GuessCategoryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
667
- let _request : carriers.AI_GuessCategoryRequest = null;
668
- let _options : base.WebApiRequestOptions = null;
669
- const first : any = ticketId;
670
- if( typeof( first ) === "object" && first && ( typeof(first.ticketId)!='undefined' ) )
671
- {
672
- _request = ticketId as carriers.AI_GuessCategoryRequest;
673
- _options = webapi_options as base.WebApiRequestOptions;
674
- }
675
- else
676
- {
677
- _request = {
678
- ticketId: ticketId as number,
679
- };
680
- _options = webapi_options;
681
- }
682
- return this._guessCategoryAsync( _request, _options );
683
- }
684
-
685
-
686
- private async _trainCategoryGuesserAsync(request: carriers.AI_TrainCategoryGuesserRequest, options?:base.WebApiRequestOptions) : Promise< string > {
687
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
688
- base.WebApiBase.SetPending(options);
689
- return new Promise< string >(async (resolve, reject) => {
690
- try {
691
- config.baseURL = this._options.baseUrl;
692
- const response = await this._axios.post("TrainCategoryGuesser", request , config);
693
- base.WebApiBase.SetCompleted(options, response);
694
- const res : string = response.data as string;
695
- resolve(res);
696
- }
697
- catch( err ) {
698
- base.WebApiBase.HandleError(options, config, err);
699
- reject(err);
700
- }
701
- });
702
- }
703
-
704
-
705
-
706
- /**
707
- * The category guesser training API will be called with an array of CategorizationTrainingItem during the (background, Batch) execution of this call
708
- * @param request - SelectionId, MaxItems, MaxTextLength
709
- * @returns Placeholder for result... should this be a BatchTaskId? maybe not useful?
710
- */
711
- public async trainCategoryGuesserAsync(request: carriers.AI_TrainCategoryGuesserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
712
-
713
- /**
714
- * The category guesser training API will be called with an array of CategorizationTrainingItem during the (background, Batch) execution of this call
715
- * @param selectionId - Id of selection of tickets, to retrieve training data from
716
- * @param maxItems - Maximum number of tickets to retrieve data from
717
- * @param maxTextLength - Maximum length of PlainTextBody or any other large text, truncated to nearest word boundary
718
- * @returns Placeholder for result... should this be a BatchTaskId? maybe not useful?
719
- */
720
- public async trainCategoryGuesserAsync(selectionId: number, maxItems: number, maxTextLength: number, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
721
-
722
- public async trainCategoryGuesserAsync(selectionId:number|carriers.AI_TrainCategoryGuesserRequest, maxItems?:number|base.WebApiRequestOptions, maxTextLength?:number, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
723
- let _request : carriers.AI_TrainCategoryGuesserRequest = null;
724
- let _options : base.WebApiRequestOptions = null;
725
- const first : any = selectionId;
726
- if( typeof( first ) === "object" && first && ( typeof(first.selectionId)!='undefined' || typeof(first.maxItems)!='undefined' || typeof(first.maxTextLength)!='undefined' ) )
727
- {
728
- _request = selectionId as carriers.AI_TrainCategoryGuesserRequest;
729
- _options = maxItems as base.WebApiRequestOptions;
730
- }
731
- else
732
- {
733
- _request = {
734
- selectionId: selectionId as number,
735
- maxItems: maxItems as number,
736
- maxTextLength: maxTextLength as number,
737
- };
738
- _options = webapi_options;
739
- }
740
- return this._trainCategoryGuesserAsync( _request, _options );
741
- }
742
-
743
-
744
- private async _getChatbotResponseAsync(request: carriers.AI_GetChatbotResponseRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
745
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
746
- base.WebApiBase.SetPending(options);
747
- return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
748
- try {
749
- config.baseURL = this._options.baseUrl;
750
- const response = await this._axios.post("GetChatbotResponse", request , config);
751
- base.WebApiBase.SetCompleted(options, response);
752
- const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
753
- resolve(res);
754
- }
755
- catch( err ) {
756
- base.WebApiBase.HandleError(options, config, err);
757
- reject(err);
758
- }
759
- });
760
- }
761
-
762
-
763
-
764
- /**
765
- * Return a chatbot response given prompt and previous turns. Stores the new turn in the history for the chatId
766
- * @param request - ChatId, IsoLangCode, UserPrompt, DisplayValue, PreviousTurns, ApiUrl
767
- * @returns Returns new turn that client can append to its local history.
768
- */
769
- public async getChatbotResponseAsync(request: carriers.AI_GetChatbotResponseRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
770
-
771
- /**
772
- * Return a chatbot response given prompt and previous turns. Stores the new turn in the history for the chatId
773
- * @param chatId - identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary)
774
- * @param isoLangCode - ISO2 Language code ('en', 'no', 'de'...) for suggestions in response
775
- * @param userPrompt - User question for chatbot
776
- * @param displayValue - User question for display - optional - null = use userPrompt
777
- * @param previousTurns - Chat history - all previous turns in chronological order
778
- * @param apiUrl - CRM API endpoint URL for chatbot to make callbacks to. 'https://example.com/superoffice/api/'
779
- * @returns Returns new turn that client can append to its local history.
780
- */
781
- public async getChatbotResponseAsync(chatId: string, isoLangCode: string, userPrompt: string, displayValue: string, previousTurns: carriers.ChatbotTurn[], apiUrl: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
782
-
783
- public async getChatbotResponseAsync(chatId:string|carriers.AI_GetChatbotResponseRequest, isoLangCode?:string|base.WebApiRequestOptions, userPrompt?:string, displayValue?:string, previousTurns?:carriers.ChatbotTurn[], apiUrl?:string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
784
- let _request : carriers.AI_GetChatbotResponseRequest = null;
785
- let _options : base.WebApiRequestOptions = null;
786
- const first : any = chatId;
787
- if( typeof( first ) === "object" && first && ( typeof(first.chatId)!='undefined' || typeof(first.isoLangCode)!='undefined' || typeof(first.userPrompt)!='undefined' || typeof(first.displayValue)!='undefined' || typeof(first.previousTurns)!='undefined' || typeof(first.apiUrl)!='undefined' ) )
788
- {
789
- _request = chatId as carriers.AI_GetChatbotResponseRequest;
790
- _options = isoLangCode as base.WebApiRequestOptions;
791
- }
792
- else
793
- {
794
- _request = {
795
- chatId: chatId as string,
796
- isoLangCode: isoLangCode as string,
797
- userPrompt: userPrompt as string,
798
- displayValue: displayValue as string,
799
- previousTurns: previousTurns as carriers.ChatbotTurn[],
800
- apiUrl: apiUrl as string,
801
- };
802
- _options = webapi_options;
803
- }
804
- return this._getChatbotResponseAsync( _request, _options );
805
- }
806
-
807
-
808
- private async _getChatbotPromptSuggestionsAsync(request: carriers.AI_GetChatbotPromptSuggestionsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
809
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
810
- base.WebApiBase.SetPending(options);
811
- return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
812
- try {
813
- config.baseURL = this._options.baseUrl;
814
- const response = await this._axios.post("GetChatbotPromptSuggestions", request , config);
815
- base.WebApiBase.SetCompleted(options, response);
816
- const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
817
- resolve(res);
818
- }
819
- catch( err ) {
820
- base.WebApiBase.HandleError(options, config, err);
821
- reject(err);
822
- }
823
- });
824
- }
825
-
826
-
827
-
828
- /**
829
- * Return one or more suggested prompts as actions to display in an empty chat window
830
- * @param request - IsoLangCode, SoProtocol, CurrentId
831
- * @returns Contains zero or more BotActions, and welcome message in Bot response
832
- */
833
- public async getChatbotPromptSuggestionsAsync(request: carriers.AI_GetChatbotPromptSuggestionsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
834
-
835
- /**
836
- * Return one or more suggested prompts as actions to display in an empty chat window
837
- * @param isoLangCode - ISO2 Language code ('en', 'no', 'de'...) for suggestions in response
838
- * @param soProtocol - Context for suggestions ('contact.main.activities')
839
- * @param currentId - current company/person/project id - used for context in suggestions
840
- * @returns Contains zero or more BotActions, and welcome message in Bot response
841
- */
842
- public async getChatbotPromptSuggestionsAsync(isoLangCode: string, soProtocol: string, currentId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
843
-
844
- public async getChatbotPromptSuggestionsAsync(isoLangCode:string|carriers.AI_GetChatbotPromptSuggestionsRequest, soProtocol?:string|base.WebApiRequestOptions, currentId?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
845
- let _request : carriers.AI_GetChatbotPromptSuggestionsRequest = null;
846
- let _options : base.WebApiRequestOptions = null;
847
- const first : any = isoLangCode;
848
- if( typeof( first ) === "object" && first && ( typeof(first.isoLangCode)!='undefined' || typeof(first.soProtocol)!='undefined' || typeof(first.currentId)!='undefined' ) )
849
- {
850
- _request = isoLangCode as carriers.AI_GetChatbotPromptSuggestionsRequest;
851
- _options = soProtocol as base.WebApiRequestOptions;
852
- }
853
- else
854
- {
855
- _request = {
856
- isoLangCode: isoLangCode as string,
857
- soProtocol: soProtocol as string,
858
- currentId: currentId as number,
859
- };
860
- _options = webapi_options;
861
- }
862
- return this._getChatbotPromptSuggestionsAsync( _request, _options );
863
- }
864
-
865
-
866
- private async _getChatbotTurnsAsync(request: carriers.AI_GetChatbotTurnsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] > {
867
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
868
- base.WebApiBase.SetPending(options);
869
- return new Promise< carriers.ChatbotTurn[] >(async (resolve, reject) => {
870
- try {
871
- config.baseURL = this._options.baseUrl;
872
- const response = await this._axios.post("GetChatbotTurns", request , config);
873
- base.WebApiBase.SetCompleted(options, response);
874
- const res : carriers.ChatbotTurn[] = converters.Create_ChatbotTurnArray_From( response.data );
875
- resolve(res);
876
- }
877
- catch( err ) {
878
- base.WebApiBase.HandleError(options, config, err);
879
- reject(err);
880
- }
881
- });
882
- }
883
-
884
-
885
-
886
- /**
887
- * Returns stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name.
888
- * @param request - ChatId
889
- * @returns Array containing zero or more turns. If you got zero turns, call GetChatbotPromptSuggestions to get an initial turn from the bot.
890
- */
891
- public async getChatbotTurnsAsync(request: carriers.AI_GetChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] >;
892
-
893
- /**
894
- * Returns stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name.
895
- * @param chatId - identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary)
896
- * @returns Array containing zero or more turns. If you got zero turns, call GetChatbotPromptSuggestions to get an initial turn from the bot.
897
- */
898
- public async getChatbotTurnsAsync(chatId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] >;
899
-
900
- public async getChatbotTurnsAsync(chatId:string|carriers.AI_GetChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] > {
901
- let _request : carriers.AI_GetChatbotTurnsRequest = null;
902
- let _options : base.WebApiRequestOptions = null;
903
- const first : any = chatId;
904
- if( typeof( first ) === "object" && first && ( typeof(first.chatId)!='undefined' ) )
905
- {
906
- _request = chatId as carriers.AI_GetChatbotTurnsRequest;
907
- _options = webapi_options as base.WebApiRequestOptions;
908
- }
909
- else
910
- {
911
- _request = {
912
- chatId: chatId as string,
913
- };
914
- _options = webapi_options;
915
- }
916
- return this._getChatbotTurnsAsync( _request, _options );
917
- }
918
-
919
-
920
- private async _clearChatbotTurnsAsync(request: carriers.AI_ClearChatbotTurnsRequest, options?:base.WebApiRequestOptions) : Promise< void > {
921
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
922
- base.WebApiBase.SetPending(options);
923
- return new Promise< void >(async (resolve, reject) => {
924
- try {
925
- config.baseURL = this._options.baseUrl;
926
- const response = await this._axios.post("ClearChatbotTurns", request , config);
927
- base.WebApiBase.SetCompleted(options, response);
928
- const res = response.data;
929
- resolve(res);
930
- }
931
- catch( err ) {
932
- base.WebApiBase.HandleError(options, config, err);
933
- reject(err);
934
- }
935
- });
936
- }
937
-
938
-
939
-
940
- /**
941
- * Clears the stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name
942
- * @param request - ChatId
943
- * @returns This method has no return value
944
- */
945
- public async clearChatbotTurnsAsync(request: carriers.AI_ClearChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
946
-
947
- /**
948
- * Clears the stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name
949
- * @param chatId - identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary)
950
- * @returns This method has no return value
951
- */
952
- public async clearChatbotTurnsAsync(chatId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
953
-
954
- public async clearChatbotTurnsAsync(chatId:string|carriers.AI_ClearChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
955
- let _request : carriers.AI_ClearChatbotTurnsRequest = null;
956
- let _options : base.WebApiRequestOptions = null;
957
- const first : any = chatId;
958
- if( typeof( first ) === "object" && first && ( typeof(first.chatId)!='undefined' ) )
959
- {
960
- _request = chatId as carriers.AI_ClearChatbotTurnsRequest;
961
- _options = webapi_options as base.WebApiRequestOptions;
962
- }
963
- else
964
- {
965
- _request = {
966
- chatId: chatId as string,
967
- };
968
- _options = webapi_options;
969
- }
970
- return this._clearChatbotTurnsAsync( _request, _options );
971
- }
972
-
973
- /**
974
- * Gets a CopilotDataSourceEntity object.
975
- * @param copilotDataSourceEntityId - The primary key.
976
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
977
- * @returns A single CopilotDataSourceEntity
978
- */
979
- public async getCopilotDataSourceEntityAsync(copilotDataSourceEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.CopilotDataSourceEntity > {
980
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
981
- base.WebApiBase.SetPending(options);
982
- return new Promise< carriers.CopilotDataSourceEntity >(async (resolve, reject) => {
983
- try {
984
- const response = await this._axios.post("GetCopilotDataSourceEntity?copilotDataSourceEntityId=" + copilotDataSourceEntityId, null, config);
985
- base.WebApiBase.SetCompleted(options, response);
986
- const res = converters.Create_CopilotDataSourceEntity_From( response.data );
987
- resolve(res);
988
- }
989
- catch( err ) {
990
- base.WebApiBase.HandleError(options, config, err);
991
- reject(err);
992
- }
993
- });
994
- }
995
-
996
- /**
997
- * Gets a CopilotEntity object.
998
- * @param copilotEntityId - The primary key.
999
- * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
1000
- * @returns A single CopilotEntity
1001
- */
1002
- public async getCopilotEntityAsync(copilotEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.CopilotEntity > {
1003
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1004
- base.WebApiBase.SetPending(options);
1005
- return new Promise< carriers.CopilotEntity >(async (resolve, reject) => {
1006
- try {
1007
- const response = await this._axios.post("GetCopilotEntity?copilotEntityId=" + copilotEntityId, null, config);
1008
- base.WebApiBase.SetCompleted(options, response);
1009
- const res = converters.Create_CopilotEntity_From( response.data );
1010
- resolve(res);
1011
- }
1012
- catch( err ) {
1013
- base.WebApiBase.HandleError(options, config, err);
1014
- reject(err);
1015
- }
1016
- });
1017
- }
1018
-
1019
-
1020
- private async _getFormDesignFromImageAsync(request: carriers.AI_GetFormDesignFromImageRequest, options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1021
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1022
- base.WebApiBase.SetPending(options);
1023
- return new Promise< carriers.StringDictionary >(async (resolve, reject) => {
1024
- try {
1025
- config.baseURL = this._options.baseUrl;
1026
- const response = await this._axios.post("GetFormDesignFromImage", request , config);
1027
- base.WebApiBase.SetCompleted(options, response);
1028
- const res : carriers.StringDictionary = converters.Create_StringDictionary_From( response.data );
1029
- resolve(res);
1030
- }
1031
- catch( err ) {
1032
- base.WebApiBase.HandleError(options, config, err);
1033
- reject(err);
1034
- }
1035
- });
1036
- }
1037
-
1038
-
1039
-
1040
- /**
1041
- * Returns Form Designer properties based on the look of a picture
1042
- * @param request - Image
1043
- * @returns Returns a Form Designer properties.
1044
- */
1045
- public async getFormDesignFromImageAsync(request: carriers.AI_GetFormDesignFromImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1046
-
1047
- /**
1048
- * Returns Form Designer properties based on the look of a picture
1049
- * @param image - Image data to analyze for design
1050
- * @returns Returns a Form Designer properties.
1051
- */
1052
- public async getFormDesignFromImageAsync(image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1053
-
1054
- public async getFormDesignFromImageAsync(image:ArrayBuffer|string|carriers.AI_GetFormDesignFromImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1055
- let _request : carriers.AI_GetFormDesignFromImageRequest = null;
1056
- let _options : base.WebApiRequestOptions = null;
1057
- const first : any = image;
1058
- if( typeof( first ) === "object" && first && ( typeof(first.image)!='undefined' ) )
1059
- {
1060
- _request = image as carriers.AI_GetFormDesignFromImageRequest;
1061
- _options = webapi_options as base.WebApiRequestOptions;
1062
- }
1063
- else
1064
- {
1065
- _request = {
1066
- image: image as ArrayBuffer|string,
1067
- };
1068
- _options = webapi_options;
1069
- }
1070
- _request.image = ToBase64(_request.image);
1071
- return this._getFormDesignFromImageAsync( _request, _options );
1072
- }
1073
-
1074
-
1075
- private async _getFormDesignFromUrlAsync(request: carriers.AI_GetFormDesignFromUrlRequest, options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1076
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1077
- base.WebApiBase.SetPending(options);
1078
- return new Promise< carriers.StringDictionary >(async (resolve, reject) => {
1079
- try {
1080
- config.baseURL = this._options.baseUrl;
1081
- const response = await this._axios.post("GetFormDesignFromUrl", request , config);
1082
- base.WebApiBase.SetCompleted(options, response);
1083
- const res : carriers.StringDictionary = converters.Create_StringDictionary_From( response.data );
1084
- resolve(res);
1085
- }
1086
- catch( err ) {
1087
- base.WebApiBase.HandleError(options, config, err);
1088
- reject(err);
1089
- }
1090
- });
1091
- }
1092
-
1093
-
1094
-
1095
- /**
1096
- * Returns Form Designer properties based on the look of a web page
1097
- * @param request - Url
1098
- * @returns Returns a Form Designer properties.
1099
- */
1100
- public async getFormDesignFromUrlAsync(request: carriers.AI_GetFormDesignFromUrlRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1101
-
1102
- /**
1103
- * Returns Form Designer properties based on the look of a web page
1104
- * @param url - Url of the web page to extract style from.
1105
- * @returns Returns a Form Designer properties.
1106
- */
1107
- public async getFormDesignFromUrlAsync(url: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1108
-
1109
- public async getFormDesignFromUrlAsync(url:string|carriers.AI_GetFormDesignFromUrlRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1110
- let _request : carriers.AI_GetFormDesignFromUrlRequest = null;
1111
- let _options : base.WebApiRequestOptions = null;
1112
- const first : any = url;
1113
- if( typeof( first ) === "object" && first && ( typeof(first.url)!='undefined' ) )
1114
- {
1115
- _request = url as carriers.AI_GetFormDesignFromUrlRequest;
1116
- _options = webapi_options as base.WebApiRequestOptions;
1117
- }
1118
- else
1119
- {
1120
- _request = {
1121
- url: url as string,
1122
- };
1123
- _options = webapi_options;
1124
- }
1125
- return this._getFormDesignFromUrlAsync( _request, _options );
1126
- }
1127
-
1128
-
1129
- private async _detectLanguageAsync(request: carriers.AI_DetectLanguageRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1130
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1131
- base.WebApiBase.SetPending(options);
1132
- return new Promise< string >(async (resolve, reject) => {
1133
- try {
1134
- config.baseURL = this._options.baseUrl;
1135
- const response = await this._axios.post("DetectLanguage", request , config);
1136
- base.WebApiBase.SetCompleted(options, response);
1137
- const res : string = response.data as string;
1138
- resolve(res);
1139
- }
1140
- catch( err ) {
1141
- base.WebApiBase.HandleError(options, config, err);
1142
- reject(err);
1143
- }
1144
- });
1145
- }
1146
-
1147
-
1148
-
1149
- /**
1150
- * Given a (reasonably short) text, detect the language it is written in
1151
- * @param request - Text
1152
- * @returns ISO Language code, such as NO, US, ES, FR
1153
- */
1154
- public async detectLanguageAsync(request: carriers.AI_DetectLanguageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1155
-
1156
- /**
1157
- * Given a (reasonably short) text, detect the language it is written in
1158
- * @param text - Text to be analyzed; there may be a cost-per-character so do not send a book here
1159
- * @returns ISO Language code, such as NO, US, ES, FR
1160
- */
1161
- public async detectLanguageAsync(text: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1162
-
1163
- public async detectLanguageAsync(text:string|carriers.AI_DetectLanguageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1164
- let _request : carriers.AI_DetectLanguageRequest = null;
1165
- let _options : base.WebApiRequestOptions = null;
1166
- const first : any = text;
1167
- if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' ) )
1168
- {
1169
- _request = text as carriers.AI_DetectLanguageRequest;
1170
- _options = webapi_options as base.WebApiRequestOptions;
1171
- }
1172
- else
1173
- {
1174
- _request = {
1175
- text: text as string,
1176
- };
1177
- _options = webapi_options;
1178
- }
1179
- return this._detectLanguageAsync( _request, _options );
1180
- }
1181
-
1182
-
1183
- private async _detectSentimentAsync(request: carriers.AI_DetectSentimentRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment > {
1184
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1185
- base.WebApiBase.SetPending(options);
1186
- return new Promise< carriers.Sentiment >(async (resolve, reject) => {
1187
- try {
1188
- config.baseURL = this._options.baseUrl;
1189
- const response = await this._axios.post("DetectSentiment", request , config);
1190
- base.WebApiBase.SetCompleted(options, response);
1191
- const res : carriers.Sentiment = converters.Create_Sentiment_From( response.data );
1192
- resolve(res);
1193
- }
1194
- catch( err ) {
1195
- base.WebApiBase.HandleError(options, config, err);
1196
- reject(err);
1197
- }
1198
- });
1199
- }
1200
-
1201
-
1202
-
1203
- /**
1204
- * Detect the sentiment of a (reasonably short) text. Sentiment analysis may cause a translation to be made, since sentiment analysis only supports a limited set of languages
1205
- * @param request - Text
1206
- * @returns The sentiment information: score (-100 to +100) and confidence
1207
- */
1208
- public async detectSentimentAsync(request: carriers.AI_DetectSentimentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment >;
1209
-
1210
- /**
1211
- * Detect the sentiment of a (reasonably short) text. Sentiment analysis may cause a translation to be made, since sentiment analysis only supports a limited set of languages
1212
- * @param text - Text to be analyzed
1213
- * @returns The sentiment information: score (-100 to +100) and confidence
1214
- */
1215
- public async detectSentimentAsync(text: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment >;
1216
-
1217
- public async detectSentimentAsync(text:string|carriers.AI_DetectSentimentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment > {
1218
- let _request : carriers.AI_DetectSentimentRequest = null;
1219
- let _options : base.WebApiRequestOptions = null;
1220
- const first : any = text;
1221
- if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' ) )
1222
- {
1223
- _request = text as carriers.AI_DetectSentimentRequest;
1224
- _options = webapi_options as base.WebApiRequestOptions;
1225
- }
1226
- else
1227
- {
1228
- _request = {
1229
- text: text as string,
1230
- };
1231
- _options = webapi_options;
1232
- }
1233
- return this._detectSentimentAsync( _request, _options );
1234
- }
1235
-
1236
-
1237
- private async _translateAsync(request: carriers.AI_TranslateRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1238
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1239
- base.WebApiBase.SetPending(options);
1240
- return new Promise< string >(async (resolve, reject) => {
1241
- try {
1242
- config.baseURL = this._options.baseUrl;
1243
- const response = await this._axios.post("Translate", request , config);
1244
- base.WebApiBase.SetCompleted(options, response);
1245
- const res : string = response.data as string;
1246
- resolve(res);
1247
- }
1248
- catch( err ) {
1249
- base.WebApiBase.HandleError(options, config, err);
1250
- reject(err);
1251
- }
1252
- });
1253
- }
1254
-
1255
-
1256
-
1257
- /**
1258
- * Translate a text from one language to another. Language of the text is automatically detected.
1259
- * @param request - Text, TargetLanguage
1260
- * @returns Translated text
1261
- */
1262
- public async translateAsync(request: carriers.AI_TranslateRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1263
-
1264
- /**
1265
- * Translate a text from one language to another. Language of the text is automatically detected.
1266
- * @param text - Text to be translated. Language of the text is automatically detected.
1267
- * @param targetLanguage - ISO Language code (such as FR) to translate the text into
1268
- * @returns Translated text
1269
- */
1270
- public async translateAsync(text: string, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1271
-
1272
- public async translateAsync(text:string|carriers.AI_TranslateRequest, targetLanguage?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1273
- let _request : carriers.AI_TranslateRequest = null;
1274
- let _options : base.WebApiRequestOptions = null;
1275
- const first : any = text;
1276
- if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.targetLanguage)!='undefined' ) )
1277
- {
1278
- _request = text as carriers.AI_TranslateRequest;
1279
- _options = targetLanguage as base.WebApiRequestOptions;
1280
- }
1281
- else
1282
- {
1283
- _request = {
1284
- text: text as string,
1285
- targetLanguage: targetLanguage as string,
1286
- };
1287
- _options = webapi_options;
1288
- }
1289
- return this._translateAsync( _request, _options );
1290
- }
1291
-
1292
-
1293
- private async _translateEntityAsync(request: carriers.AI_TranslateEntityRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1294
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1295
- base.WebApiBase.SetPending(options);
1296
- return new Promise< string >(async (resolve, reject) => {
1297
- try {
1298
- config.baseURL = this._options.baseUrl;
1299
- const response = await this._axios.post("TranslateEntity", request , config);
1300
- base.WebApiBase.SetCompleted(options, response);
1301
- const res : string = response.data as string;
1302
- resolve(res);
1303
- }
1304
- catch( err ) {
1305
- base.WebApiBase.HandleError(options, config, err);
1306
- reject(err);
1307
- }
1308
- });
1309
- }
1310
-
1311
-
1312
-
1313
- /**
1314
- * Retrieve, format and translate text for an entity to a specified language
1315
- * @param request - EntityName, EntityId, TargetLanguage
1316
- * @returns Translated text
1317
- */
1318
- public async translateEntityAsync(request: carriers.AI_TranslateEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1319
-
1320
- /**
1321
- * Retrieve, format and translate text for an entity to a specified language
1322
- * @param entityName - Name of entity to get the text to be translated; eg., 'ticketMessage'
1323
- * @param entityId - Identifier for the entity to get text to be translated
1324
- * @param targetLanguage - ISO Language code (such as FR) to translate the text into
1325
- * @returns Translated text
1326
- */
1327
- public async translateEntityAsync(entityName: string, entityId: number, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1328
-
1329
- public async translateEntityAsync(entityName:string|carriers.AI_TranslateEntityRequest, entityId?:number|base.WebApiRequestOptions, targetLanguage?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1330
- let _request : carriers.AI_TranslateEntityRequest = null;
1331
- let _options : base.WebApiRequestOptions = null;
1332
- const first : any = entityName;
1333
- if( typeof( first ) === "object" && first && ( typeof(first.entityName)!='undefined' || typeof(first.entityId)!='undefined' || typeof(first.targetLanguage)!='undefined' ) )
1334
- {
1335
- _request = entityName as carriers.AI_TranslateEntityRequest;
1336
- _options = entityId as base.WebApiRequestOptions;
1337
- }
1338
- else
1339
- {
1340
- _request = {
1341
- entityName: entityName as string,
1342
- entityId: entityId as number,
1343
- targetLanguage: targetLanguage as string,
1344
- };
1345
- _options = webapi_options;
1346
- }
1347
- return this._translateEntityAsync( _request, _options );
1348
- }
1349
-
1350
-
1351
- private async _answerAsync(request: carriers.AI_AnswerRequest, options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer > {
1352
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1353
- base.WebApiBase.SetPending(options);
1354
- return new Promise< carriers.RagAnswer >(async (resolve, reject) => {
1355
- try {
1356
- config.baseURL = this._options.baseUrl;
1357
- const response = await this._axios.post("Answer", request , config);
1358
- base.WebApiBase.SetCompleted(options, response);
1359
- const res : carriers.RagAnswer = converters.Create_RagAnswer_From( response.data );
1360
- resolve(res);
1361
- }
1362
- catch( err ) {
1363
- base.WebApiBase.HandleError(options, config, err);
1364
- reject(err);
1365
- }
1366
- });
1367
- }
1368
-
1369
-
1370
-
1371
- /**
1372
- * Returns an answer.
1373
- * @param request - NamespaceName, Query, Type, Top
1374
- * @returns Generated answer based on query.
1375
- */
1376
- public async answerAsync(request: carriers.AI_AnswerRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
1377
-
1378
- /**
1379
- * Returns an answer.
1380
- * @param namespaceName - Defines the search domain used for generating answer. e.g. 'ServiceCopilot'
1381
- * @param query - Question. The search query to answer.
1382
- * @param type - Filter results based on content type. Default: None = no filtering
1383
- * @param top - Max Number of results to use in generating answer.
1384
- * @returns Generated answer based on query.
1385
- */
1386
- public async answerAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
1387
-
1388
- public async answerAsync(namespaceName:string|carriers.AI_AnswerRequest, query?:string|base.WebApiRequestOptions, type?:enums.RagType, top?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer > {
1389
- let _request : carriers.AI_AnswerRequest = null;
1390
- let _options : base.WebApiRequestOptions = null;
1391
- const first : any = namespaceName;
1392
- if( typeof( first ) === "object" && first && ( typeof(first.namespaceName)!='undefined' || typeof(first.query)!='undefined' || typeof(first.type)!='undefined' || typeof(first.top)!='undefined' ) )
1393
- {
1394
- _request = namespaceName as carriers.AI_AnswerRequest;
1395
- _options = query as base.WebApiRequestOptions;
1396
- }
1397
- else
1398
- {
1399
- _request = {
1400
- namespaceName: namespaceName as string,
1401
- query: query as string,
1402
- type: type as enums.RagType,
1403
- top: top as number,
1404
- };
1405
- _options = webapi_options;
1406
- }
1407
- return this._answerAsync( _request, _options );
1408
- }
1409
-
1410
-
1411
- private async _answerFeedbackAsync(request: carriers.AI_AnswerFeedbackRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1412
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1413
- base.WebApiBase.SetPending(options);
1414
- return new Promise< void >(async (resolve, reject) => {
1415
- try {
1416
- config.baseURL = this._options.baseUrl;
1417
- const response = await this._axios.post("AnswerFeedback", request , config);
1418
- base.WebApiBase.SetCompleted(options, response);
1419
- const res = response.data;
1420
- resolve(res);
1421
- }
1422
- catch( err ) {
1423
- base.WebApiBase.HandleError(options, config, err);
1424
- reject(err);
1425
- }
1426
- });
1427
- }
1428
-
1429
-
1430
-
1431
- /**
1432
- * Send feedback on answer - feedback is logged and used to improve the answer algorithm.
1433
- * @param request - TrackingId, IsThumbsUp
1434
- * @returns This method has no return value
1435
- */
1436
- public async answerFeedbackAsync(request: carriers.AI_AnswerFeedbackRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1437
-
1438
- /**
1439
- * Send feedback on answer - feedback is logged and used to improve the answer algorithm.
1440
- * @param trackingId - The id of the answer that you are giving feedback to.
1441
- * @param isThumbsUp - True = Like, False = Dislike.
1442
- * @returns This method has no return value
1443
- */
1444
- public async answerFeedbackAsync(trackingId: string, isThumbsUp: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1445
-
1446
- public async answerFeedbackAsync(trackingId:string|carriers.AI_AnswerFeedbackRequest, isThumbsUp?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1447
- let _request : carriers.AI_AnswerFeedbackRequest = null;
1448
- let _options : base.WebApiRequestOptions = null;
1449
- const first : any = trackingId;
1450
- if( typeof( first ) === "object" && first && ( typeof(first.trackingId)!='undefined' || typeof(first.isThumbsUp)!='undefined' ) )
1451
- {
1452
- _request = trackingId as carriers.AI_AnswerFeedbackRequest;
1453
- _options = isThumbsUp as base.WebApiRequestOptions;
1454
- }
1455
- else
1456
- {
1457
- _request = {
1458
- trackingId: trackingId as string,
1459
- isThumbsUp: isThumbsUp as boolean,
1460
- };
1461
- _options = webapi_options;
1462
- }
1463
- return this._answerFeedbackAsync( _request, _options );
1464
- }
1465
-
1466
-
1467
- private async _answerAcceptedAsync(request: carriers.AI_AnswerAcceptedRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1468
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1469
- base.WebApiBase.SetPending(options);
1470
- return new Promise< void >(async (resolve, reject) => {
1471
- try {
1472
- config.baseURL = this._options.baseUrl;
1473
- const response = await this._axios.post("AnswerAccepted", request , config);
1474
- base.WebApiBase.SetCompleted(options, response);
1475
- const res = response.data;
1476
- resolve(res);
1477
- }
1478
- catch( err ) {
1479
- base.WebApiBase.HandleError(options, config, err);
1480
- reject(err);
1481
- }
1482
- });
1483
- }
1484
-
1485
-
1486
-
1487
- /**
1488
- * Signal that answer was inserted into response- feedback is logged and used to improve the answer algorithm.
1489
- * @param request - TrackingId
1490
- * @returns This method has no return value
1491
- */
1492
- public async answerAcceptedAsync(request: carriers.AI_AnswerAcceptedRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1493
-
1494
- /**
1495
- * Signal that answer was inserted into response- feedback is logged and used to improve the answer algorithm.
1496
- * @param trackingId - The id of the answer that you are giving feedback to.
1497
- * @returns This method has no return value
1498
- */
1499
- public async answerAcceptedAsync(trackingId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1500
-
1501
- public async answerAcceptedAsync(trackingId:string|carriers.AI_AnswerAcceptedRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1502
- let _request : carriers.AI_AnswerAcceptedRequest = null;
1503
- let _options : base.WebApiRequestOptions = null;
1504
- const first : any = trackingId;
1505
- if( typeof( first ) === "object" && first && ( typeof(first.trackingId)!='undefined' ) )
1506
- {
1507
- _request = trackingId as carriers.AI_AnswerAcceptedRequest;
1508
- _options = webapi_options as base.WebApiRequestOptions;
1509
- }
1510
- else
1511
- {
1512
- _request = {
1513
- trackingId: trackingId as string,
1514
- };
1515
- _options = webapi_options;
1516
- }
1517
- return this._answerAcceptedAsync( _request, _options );
1518
- }
1519
-
1520
-
1521
- private async _searchAsync(request: carriers.AI_SearchRequest, options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] > {
1522
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1523
- base.WebApiBase.SetPending(options);
1524
- return new Promise< carriers.RagResult[] >(async (resolve, reject) => {
1525
- try {
1526
- config.baseURL = this._options.baseUrl;
1527
- const response = await this._axios.post("Search", request , config);
1528
- base.WebApiBase.SetCompleted(options, response);
1529
- const res : carriers.RagResult[] = converters.Create_RagResultArray_From( response.data );
1530
- resolve(res);
1531
- }
1532
- catch( err ) {
1533
- base.WebApiBase.HandleError(options, config, err);
1534
- reject(err);
1535
- }
1536
- });
1537
- }
1538
-
1539
-
1540
-
1541
- /**
1542
- * Returns semantic search results from vector database.
1543
- * @param request - NamespaceName, Query, Type, Top
1544
- * @returns Array containing vector search results
1545
- */
1546
- public async searchAsync(request: carriers.AI_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
1547
-
1548
- /**
1549
- * Returns semantic search results from vector database.
1550
- * @param namespaceName - Defines the search domain. e.g. 'ServiceCopilot'.
1551
- * @param query - Search query.
1552
- * @param type - Filter results based on a specific content type. Default: None = no filtering
1553
- * @param top - Max Number of results to return.
1554
- * @returns Array containing vector search results
1555
- */
1556
- public async searchAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
1557
-
1558
- public async searchAsync(namespaceName:string|carriers.AI_SearchRequest, query?:string|base.WebApiRequestOptions, type?:enums.RagType, top?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] > {
1559
- let _request : carriers.AI_SearchRequest = null;
1560
- let _options : base.WebApiRequestOptions = null;
1561
- const first : any = namespaceName;
1562
- if( typeof( first ) === "object" && first && ( typeof(first.namespaceName)!='undefined' || typeof(first.query)!='undefined' || typeof(first.type)!='undefined' || typeof(first.top)!='undefined' ) )
1563
- {
1564
- _request = namespaceName as carriers.AI_SearchRequest;
1565
- _options = query as base.WebApiRequestOptions;
1566
- }
1567
- else
1568
- {
1569
- _request = {
1570
- namespaceName: namespaceName as string,
1571
- query: query as string,
1572
- type: type as enums.RagType,
1573
- top: top as number,
1574
- };
1575
- _options = webapi_options;
1576
- }
1577
- return this._searchAsync( _request, _options );
1578
- }
1579
-
1580
-
1581
- private async _startRagIndexingAsync(request: carriers.AI_StartRagIndexingRequest, options?:base.WebApiRequestOptions) : Promise< number > {
1582
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1583
- base.WebApiBase.SetPending(options);
1584
- return new Promise< number >(async (resolve, reject) => {
1585
- try {
1586
- config.baseURL = this._options.baseUrl;
1587
- const response = await this._axios.post("StartRagIndexing", request , config);
1588
- base.WebApiBase.SetCompleted(options, response);
1589
- const res : number = response.data as number;
1590
- resolve(res);
1591
- }
1592
- catch( err ) {
1593
- base.WebApiBase.HandleError(options, config, err);
1594
- reject(err);
1595
- }
1596
- });
1597
- }
1598
-
1599
-
1600
-
1601
- /**
1602
- * Kicks off a batch task to update the RAG index
1603
- * @param request - NamespaceName, SourceId
1604
- * @returns The batch task id
1605
- */
1606
- public async startRagIndexingAsync(request: carriers.AI_StartRagIndexingRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1607
-
1608
- /**
1609
- * Kicks off a batch task to update the RAG index
1610
- * @param namespaceName - Defines the search domain. e.g. 'ServiceCopilot'.
1611
- * @param sourceId - (Optional) Identifies the data source to update. Blank = all sources
1612
- * @returns The batch task id
1613
- */
1614
- public async startRagIndexingAsync(namespaceName: string, sourceId: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1615
-
1616
- public async startRagIndexingAsync(namespaceName:string|carriers.AI_StartRagIndexingRequest, sourceId?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
1617
- let _request : carriers.AI_StartRagIndexingRequest = null;
1618
- let _options : base.WebApiRequestOptions = null;
1619
- const first : any = namespaceName;
1620
- if( typeof( first ) === "object" && first && ( typeof(first.namespaceName)!='undefined' || typeof(first.sourceId)!='undefined' ) )
1621
- {
1622
- _request = namespaceName as carriers.AI_StartRagIndexingRequest;
1623
- _options = sourceId as base.WebApiRequestOptions;
1624
- }
1625
- else
1626
- {
1627
- _request = {
1628
- namespaceName: namespaceName as string,
1629
- sourceId: sourceId as string,
1630
- };
1631
- _options = webapi_options;
1632
- }
1633
- return this._startRagIndexingAsync( _request, _options );
1634
- }
1635
-
1636
-
1637
- private async _summarizeTicketAsync(request: carriers.AI_SummarizeTicketRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1638
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1639
- base.WebApiBase.SetPending(options);
1640
- return new Promise< string >(async (resolve, reject) => {
1641
- try {
1642
- config.baseURL = this._options.baseUrl;
1643
- const response = await this._axios.post("SummarizeTicket", request , config);
1644
- base.WebApiBase.SetCompleted(options, response);
1645
- const res : string = response.data as string;
1646
- resolve(res);
1647
- }
1648
- catch( err ) {
1649
- base.WebApiBase.HandleError(options, config, err);
1650
- reject(err);
1651
- }
1652
- });
1653
- }
1654
-
1655
-
1656
-
1657
- /**
1658
- * Generate a short summary of the messages on a ticket
1659
- * @param request - TicketId, NumSentences, IsoLangCode
1660
- * @returns Short summary of the messages on a ticket - in HTML.
1661
- */
1662
- public async summarizeTicketAsync(request: carriers.AI_SummarizeTicketRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1663
-
1664
- /**
1665
- * Generate a short summary of the messages on a ticket
1666
- * @param ticketId - Ticket id to summarize
1667
- * @param numSentences - Length of summary
1668
- * @param isoLangCode - Language returned text should be in
1669
- * @returns Short summary of the messages on a ticket - in HTML.
1670
- */
1671
- public async summarizeTicketAsync(ticketId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1672
-
1673
- public async summarizeTicketAsync(ticketId:number|carriers.AI_SummarizeTicketRequest, numSentences?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1674
- let _request : carriers.AI_SummarizeTicketRequest = null;
1675
- let _options : base.WebApiRequestOptions = null;
1676
- const first : any = ticketId;
1677
- if( typeof( first ) === "object" && first && ( typeof(first.ticketId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1678
- {
1679
- _request = ticketId as carriers.AI_SummarizeTicketRequest;
1680
- _options = numSentences as base.WebApiRequestOptions;
1681
- }
1682
- else
1683
- {
1684
- _request = {
1685
- ticketId: ticketId as number,
1686
- numSentences: numSentences as number,
1687
- isoLangCode: isoLangCode as string,
1688
- };
1689
- _options = webapi_options;
1690
- }
1691
- return this._summarizeTicketAsync( _request, _options );
1692
- }
1693
-
1694
-
1695
- private async _getSummarizeTicketPromptAsync(request: carriers.AI_GetSummarizeTicketPromptRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1696
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1697
- base.WebApiBase.SetPending(options);
1698
- return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
1699
- try {
1700
- config.baseURL = this._options.baseUrl;
1701
- const response = await this._axios.post("GetSummarizeTicketPrompt", request , config);
1702
- base.WebApiBase.SetCompleted(options, response);
1703
- const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
1704
- resolve(res);
1705
- }
1706
- catch( err ) {
1707
- base.WebApiBase.HandleError(options, config, err);
1708
- reject(err);
1709
- }
1710
- });
1711
- }
1712
-
1713
-
1714
-
1715
- /**
1716
- * Return the prompt used to get a short summary of the messages on a ticket. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1717
- * @param request - TicketId, NumSentences, Summary, IsoLangCode
1718
- * @returns Display text and Prompt used to generate a short summary of the messages on a ticket.
1719
- */
1720
- public async getSummarizeTicketPromptAsync(request: carriers.AI_GetSummarizeTicketPromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1721
-
1722
- /**
1723
- * Return the prompt used to get a short summary of the messages on a ticket. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1724
- * @param ticketId - Ticket id to summarize
1725
- * @param numSentences - Length of summary
1726
- * @param summary - Chatbot's summary of the ticket
1727
- * @param isoLangCode - Language returned text should be in
1728
- * @returns Display text and Prompt used to generate a short summary of the messages on a ticket.
1729
- */
1730
- public async getSummarizeTicketPromptAsync(ticketId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1731
-
1732
- public async getSummarizeTicketPromptAsync(ticketId:number|carriers.AI_GetSummarizeTicketPromptRequest, numSentences?:number|base.WebApiRequestOptions, summary?:string, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1733
- let _request : carriers.AI_GetSummarizeTicketPromptRequest = null;
1734
- let _options : base.WebApiRequestOptions = null;
1735
- const first : any = ticketId;
1736
- if( typeof( first ) === "object" && first && ( typeof(first.ticketId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.summary)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1737
- {
1738
- _request = ticketId as carriers.AI_GetSummarizeTicketPromptRequest;
1739
- _options = numSentences as base.WebApiRequestOptions;
1740
- }
1741
- else
1742
- {
1743
- _request = {
1744
- ticketId: ticketId as number,
1745
- numSentences: numSentences as number,
1746
- summary: summary as string,
1747
- isoLangCode: isoLangCode as string,
1748
- };
1749
- _options = webapi_options;
1750
- }
1751
- return this._getSummarizeTicketPromptAsync( _request, _options );
1752
- }
1753
-
1754
-
1755
- private async _summarizeContactAsync(request: carriers.AI_SummarizeContactRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1756
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1757
- base.WebApiBase.SetPending(options);
1758
- return new Promise< string >(async (resolve, reject) => {
1759
- try {
1760
- config.baseURL = this._options.baseUrl;
1761
- const response = await this._axios.post("SummarizeContact", request , config);
1762
- base.WebApiBase.SetCompleted(options, response);
1763
- const res : string = response.data as string;
1764
- resolve(res);
1765
- }
1766
- catch( err ) {
1767
- base.WebApiBase.HandleError(options, config, err);
1768
- reject(err);
1769
- }
1770
- });
1771
- }
1772
-
1773
-
1774
-
1775
- /**
1776
- * Generate a short summary of the activities on a contact
1777
- * @param request - ContactId, NumSentences, IsoLangCode
1778
- * @returns Short summary of the activities on a contact - in HTML.
1779
- */
1780
- public async summarizeContactAsync(request: carriers.AI_SummarizeContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1781
-
1782
- /**
1783
- * Generate a short summary of the activities on a contact
1784
- * @param contactId - Contact id to summarize
1785
- * @param numSentences - Length of summary
1786
- * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
1787
- * @returns Short summary of the activities on a contact - in HTML.
1788
- */
1789
- public async summarizeContactAsync(contactId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1790
-
1791
- public async summarizeContactAsync(contactId:number|carriers.AI_SummarizeContactRequest, numSentences?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1792
- let _request : carriers.AI_SummarizeContactRequest = null;
1793
- let _options : base.WebApiRequestOptions = null;
1794
- const first : any = contactId;
1795
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1796
- {
1797
- _request = contactId as carriers.AI_SummarizeContactRequest;
1798
- _options = numSentences as base.WebApiRequestOptions;
1799
- }
1800
- else
1801
- {
1802
- _request = {
1803
- contactId: contactId as number,
1804
- numSentences: numSentences as number,
1805
- isoLangCode: isoLangCode as string,
1806
- };
1807
- _options = webapi_options;
1808
- }
1809
- return this._summarizeContactAsync( _request, _options );
1810
- }
1811
-
1812
-
1813
- private async _getSummarizeContactPromptAsync(request: carriers.AI_GetSummarizeContactPromptRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1814
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1815
- base.WebApiBase.SetPending(options);
1816
- return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
1817
- try {
1818
- config.baseURL = this._options.baseUrl;
1819
- const response = await this._axios.post("GetSummarizeContactPrompt", request , config);
1820
- base.WebApiBase.SetCompleted(options, response);
1821
- const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
1822
- resolve(res);
1823
- }
1824
- catch( err ) {
1825
- base.WebApiBase.HandleError(options, config, err);
1826
- reject(err);
1827
- }
1828
- });
1829
- }
1830
-
1831
-
1832
-
1833
- /**
1834
- * Return the prompt used to get a short summary of the activities on a contact. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1835
- * @param request - ContactId, NumSentences, Summary, IsoLangCode
1836
- * @returns Display text and Prompt used to generate a short summary of the activities on a contact.
1837
- */
1838
- public async getSummarizeContactPromptAsync(request: carriers.AI_GetSummarizeContactPromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1839
-
1840
- /**
1841
- * Return the prompt used to get a short summary of the activities on a contact. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1842
- * @param contactId - Contact id to summarize
1843
- * @param numSentences - Length of summary
1844
- * @param summary - Chatbot's summary of the contact activities
1845
- * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
1846
- * @returns Display text and Prompt used to generate a short summary of the activities on a contact.
1847
- */
1848
- public async getSummarizeContactPromptAsync(contactId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1849
-
1850
- public async getSummarizeContactPromptAsync(contactId:number|carriers.AI_GetSummarizeContactPromptRequest, numSentences?:number|base.WebApiRequestOptions, summary?:string, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1851
- let _request : carriers.AI_GetSummarizeContactPromptRequest = null;
1852
- let _options : base.WebApiRequestOptions = null;
1853
- const first : any = contactId;
1854
- if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.summary)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1855
- {
1856
- _request = contactId as carriers.AI_GetSummarizeContactPromptRequest;
1857
- _options = numSentences as base.WebApiRequestOptions;
1858
- }
1859
- else
1860
- {
1861
- _request = {
1862
- contactId: contactId as number,
1863
- numSentences: numSentences as number,
1864
- summary: summary as string,
1865
- isoLangCode: isoLangCode as string,
1866
- };
1867
- _options = webapi_options;
1868
- }
1869
- return this._getSummarizeContactPromptAsync( _request, _options );
1870
- }
1871
-
1872
-
1873
- private async _summarizeSaleAsync(request: carriers.AI_SummarizeSaleRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1874
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1875
- base.WebApiBase.SetPending(options);
1876
- return new Promise< string >(async (resolve, reject) => {
1877
- try {
1878
- config.baseURL = this._options.baseUrl;
1879
- const response = await this._axios.post("SummarizeSale", request , config);
1880
- base.WebApiBase.SetCompleted(options, response);
1881
- const res : string = response.data as string;
1882
- resolve(res);
1883
- }
1884
- catch( err ) {
1885
- base.WebApiBase.HandleError(options, config, err);
1886
- reject(err);
1887
- }
1888
- });
1889
- }
1890
-
1891
-
1892
-
1893
- /**
1894
- * Generate a short summary of the activities on a sale
1895
- * @param request - SaleId, NumSentences, IsoLangCode
1896
- * @returns Short summary of the activities on a sale - in HTML.
1897
- */
1898
- public async summarizeSaleAsync(request: carriers.AI_SummarizeSaleRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1899
-
1900
- /**
1901
- * Generate a short summary of the activities on a sale
1902
- * @param saleId - Sale id to summarize
1903
- * @param numSentences - Length of summary
1904
- * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
1905
- * @returns Short summary of the activities on a sale - in HTML.
1906
- */
1907
- public async summarizeSaleAsync(saleId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1908
-
1909
- public async summarizeSaleAsync(saleId:number|carriers.AI_SummarizeSaleRequest, numSentences?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1910
- let _request : carriers.AI_SummarizeSaleRequest = null;
1911
- let _options : base.WebApiRequestOptions = null;
1912
- const first : any = saleId;
1913
- if( typeof( first ) === "object" && first && ( typeof(first.saleId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1914
- {
1915
- _request = saleId as carriers.AI_SummarizeSaleRequest;
1916
- _options = numSentences as base.WebApiRequestOptions;
1917
- }
1918
- else
1919
- {
1920
- _request = {
1921
- saleId: saleId as number,
1922
- numSentences: numSentences as number,
1923
- isoLangCode: isoLangCode as string,
1924
- };
1925
- _options = webapi_options;
1926
- }
1927
- return this._summarizeSaleAsync( _request, _options );
1928
- }
1929
-
1930
-
1931
- private async _getSummarizeSalePromptAsync(request: carriers.AI_GetSummarizeSalePromptRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1932
- const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1933
- base.WebApiBase.SetPending(options);
1934
- return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
1935
- try {
1936
- config.baseURL = this._options.baseUrl;
1937
- const response = await this._axios.post("GetSummarizeSalePrompt", request , config);
1938
- base.WebApiBase.SetCompleted(options, response);
1939
- const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
1940
- resolve(res);
1941
- }
1942
- catch( err ) {
1943
- base.WebApiBase.HandleError(options, config, err);
1944
- reject(err);
1945
- }
1946
- });
1947
- }
1948
-
1949
-
1950
-
1951
- /**
1952
- * Return the prompt used to get a short summary of the activities on a sale. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1953
- * @param request - SaleId, NumSentences, Summary, IsoLangCode
1954
- * @returns Display text and Prompt used to generate a short summary of the activities on a sale.
1955
- */
1956
- public async getSummarizeSalePromptAsync(request: carriers.AI_GetSummarizeSalePromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1957
-
1958
- /**
1959
- * Return the prompt used to get a short summary of the activities on a sale. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1960
- * @param saleId - Sale id to summarize
1961
- * @param numSentences - Length of summary
1962
- * @param summary - Chatbot's summary of the sale activities
1963
- * @param isoLangCode - Language returned text should be in
1964
- * @returns Display text and Prompt used to generate a short summary of the activities on a sale.
1965
- */
1966
- public async getSummarizeSalePromptAsync(saleId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1967
-
1968
- public async getSummarizeSalePromptAsync(saleId:number|carriers.AI_GetSummarizeSalePromptRequest, numSentences?:number|base.WebApiRequestOptions, summary?:string, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1969
- let _request : carriers.AI_GetSummarizeSalePromptRequest = null;
1970
- let _options : base.WebApiRequestOptions = null;
1971
- const first : any = saleId;
1972
- if( typeof( first ) === "object" && first && ( typeof(first.saleId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.summary)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1973
- {
1974
- _request = saleId as carriers.AI_GetSummarizeSalePromptRequest;
1975
- _options = numSentences as base.WebApiRequestOptions;
1976
- }
1977
- else
1978
- {
1979
- _request = {
1980
- saleId: saleId as number,
1981
- numSentences: numSentences as number,
1982
- summary: summary as string,
1983
- isoLangCode: isoLangCode as string,
1984
- };
1985
- _options = webapi_options;
1986
- }
1987
- return this._getSummarizeSalePromptAsync( _request, _options );
1988
- }
1989
-
1990
- } // class v1AIAgentController
1991
-
1992
-
1
+ // <auto-generated>
2
+ // SuperOffice Code Generator
3
+ // modelling\templates\servicestswebapi\tswebapiagents.tt
4
+ // </auto-generated>
5
+
6
+
7
+ /* tslint:disable */
8
+ //----------------------------------------------------------------------------
9
+ // G E N E R A T E D F I L E ! D O N O T E D I T !
10
+ //----------------------------------------------------------------------------
11
+ //
12
+ // File: WebApi/AIAgent.ts
13
+ //
14
+ //----------------------------------------------------------------------------
15
+ // Copyright (C) SuperOffice AS
16
+ //----------------------------------------------------------------------------
17
+
18
+ import { AxiosRequestConfig } from 'axios';
19
+ import { Duration } from 'dayjs/plugin/duration';
20
+ import * as enums from './Enums';
21
+ import * as base from './WebApiBase';
22
+ import * as carriers from './Carriers';
23
+ import * as converters from './Converters';
24
+ import { FromBase64ToString, ToBase64 } from './Base64';
25
+
26
+ /**
27
+ * AI services, such as Translation, Statistics, Sentiment analysis, backed by calls to Public Cloud providers
28
+ */
29
+ export interface IAIAgent {
30
+ createDefaultCopilotDataSourceEntityAsync(): Promise< carriers.CopilotDataSourceEntity >;
31
+ saveCopilotDataSourceEntityAsync(entity: carriers.CopilotDataSourceEntity) : Promise< carriers.CopilotDataSourceEntity >;
32
+ deleteCopilotDataSourceEntityAsync(CopilotDataSourceEntityId: number) : Promise<void>;
33
+ createDefaultCopilotEntityAsync(): Promise< carriers.CopilotEntity >;
34
+ saveCopilotEntityAsync(entity: carriers.CopilotEntity) : Promise< carriers.CopilotEntity >;
35
+ deleteCopilotEntityAsync(CopilotEntityId: number) : Promise<void>;
36
+ summarizeTextAsync(request: carriers.AI_SummarizeTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
37
+ summarizeTextAsync(text: string, percentSmaller: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
38
+ expandTextAsync(request: carriers.AI_ExpandTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
39
+ expandTextAsync(text: string, percentBigger: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
40
+ rephraseTextAsync(request: carriers.AI_RephraseTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
41
+ rephraseTextAsync(text: string, style: enums.AiTextStyle, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
42
+ createTextForAppointmentAsync(request: carriers.AI_CreateTextForAppointmentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
43
+ createTextForAppointmentAsync(appointment: carriers.AppointmentEntity, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
44
+ analyzeBizCardImageAsync(request: carriers.AI_AnalyzeBizCardImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
45
+ analyzeBizCardImageAsync(image: ArrayBuffer|string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
46
+ analyzeBizCardTextAsync(request: carriers.AI_AnalyzeBizCardTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
47
+ analyzeBizCardTextAsync(text: string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
48
+ getTrainingStatusAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CategorizationStatusResponse >;
49
+ guessCategoryAsync(request: carriers.AI_GuessCategoryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
50
+ guessCategoryAsync(ticketId: number, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
51
+ trainCategoryGuesserAsync(request: carriers.AI_TrainCategoryGuesserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
52
+ trainCategoryGuesserAsync(selectionId: number, maxItems: number, maxTextLength: number, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
53
+ getChatbotResponseAsync(request: carriers.AI_GetChatbotResponseRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
54
+ getChatbotResponseAsync(chatId: string, isoLangCode: string, userPrompt: string, displayValue: string, previousTurns: carriers.ChatbotTurn[], apiUrl: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
55
+ getChatbotPromptSuggestionsAsync(request: carriers.AI_GetChatbotPromptSuggestionsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
56
+ getChatbotPromptSuggestionsAsync(isoLangCode: string, soProtocol: string, currentId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
57
+ getChatbotTurnsAsync(request: carriers.AI_GetChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] >;
58
+ getChatbotTurnsAsync(chatId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] >;
59
+ clearChatbotTurnsAsync(request: carriers.AI_ClearChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
60
+ clearChatbotTurnsAsync(chatId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
61
+ getCopilotDataSourceEntityAsync(copilotDataSourceEntityId: number) : Promise< carriers.CopilotDataSourceEntity >;
62
+ getCopilotEntityAsync(copilotEntityId: number) : Promise< carriers.CopilotEntity >;
63
+ getFormDesignFromImageAsync(request: carriers.AI_GetFormDesignFromImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
64
+ getFormDesignFromImageAsync(image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
65
+ getFormDesignFromUrlAsync(request: carriers.AI_GetFormDesignFromUrlRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
66
+ getFormDesignFromUrlAsync(url: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
67
+ detectLanguageAsync(request: carriers.AI_DetectLanguageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
68
+ detectLanguageAsync(text: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
69
+ detectSentimentAsync(request: carriers.AI_DetectSentimentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment >;
70
+ detectSentimentAsync(text: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment >;
71
+ translateAsync(request: carriers.AI_TranslateRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
72
+ translateAsync(text: string, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
73
+ translateEntityAsync(request: carriers.AI_TranslateEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
74
+ translateEntityAsync(entityName: string, entityId: number, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
75
+ answerAsync(request: carriers.AI_AnswerRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
76
+ answerAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
77
+ answerFeedbackAsync(request: carriers.AI_AnswerFeedbackRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
78
+ answerFeedbackAsync(trackingId: string, isThumbsUp: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
79
+ answerAcceptedAsync(request: carriers.AI_AnswerAcceptedRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
80
+ answerAcceptedAsync(trackingId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
81
+ searchAsync(request: carriers.AI_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
82
+ searchAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
83
+ startRagIndexingAsync(request: carriers.AI_StartRagIndexingRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
84
+ startRagIndexingAsync(namespaceName: string, sourceId: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
85
+ summarizeTicketAsync(request: carriers.AI_SummarizeTicketRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
86
+ summarizeTicketAsync(ticketId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
87
+ getSummarizeTicketPromptAsync(request: carriers.AI_GetSummarizeTicketPromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
88
+ getSummarizeTicketPromptAsync(ticketId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
89
+ summarizeContactAsync(request: carriers.AI_SummarizeContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
90
+ summarizeContactAsync(contactId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
91
+ getSummarizeContactPromptAsync(request: carriers.AI_GetSummarizeContactPromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
92
+ getSummarizeContactPromptAsync(contactId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
93
+ summarizeSaleAsync(request: carriers.AI_SummarizeSaleRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
94
+ summarizeSaleAsync(saleId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
95
+ getSummarizeSalePromptAsync(request: carriers.AI_GetSummarizeSalePromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
96
+ getSummarizeSalePromptAsync(saleId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
97
+ } // interface IAIAgent
98
+
99
+
100
+
101
+
102
+ /**
103
+ * AI services, such as Translation, Statistics, Sentiment analysis, backed by calls to Public Cloud providers
104
+ */
105
+ export class AIAgent extends base.WebApiBase implements IAIAgent {
106
+ constructor(baseUrl?: string, languageCode?:string, cultureCode?: string);
107
+ constructor(baseUrl?: string, resourceParsing?: base.ResourceParsing);
108
+ constructor(baseUrl: string, resourceManager:any);
109
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceManager:any);
110
+ constructor(baseUrl: string, config:AxiosRequestConfig, resourceParsing?: base.ResourceParsing);
111
+ constructor(baseUrl: string, config:AxiosRequestConfig, languageCode?:string, cultureCode?: string);
112
+ constructor(options: base.WebApiOptions);
113
+
114
+ constructor(baseUrlOrOptions: string|base.WebApiOptions|undefined,
115
+ langOrconfigOrRM?: string|base.ResourceParsing|AxiosRequestConfig|any,
116
+ langOrResourceOrRM?:string|base.ResourceParsing|any,
117
+ cultureCode?: string,
118
+ ) {
119
+ const options = base.WebApiBase.FigureOutOptions(baseUrlOrOptions, langOrconfigOrRM, langOrResourceOrRM, cultureCode);
120
+ options.basePath = "v1/Agents/AI/";
121
+ super(options);
122
+ }
123
+
124
+
125
+
126
+ /**
127
+ * Set default values into a new CopilotDataSourceEntity.
128
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
129
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
130
+ * @returns A blank entity.
131
+ */
132
+ public async createDefaultCopilotDataSourceEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.CopilotDataSourceEntity > {
133
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
134
+ base.WebApiBase.SetPending(options);
135
+ return new Promise< carriers.CopilotDataSourceEntity >(async (resolve, reject) => {
136
+ try {
137
+ const response = await this._axios.post("CreateDefaultCopilotDataSourceEntity", null, config);
138
+ base.WebApiBase.SetCompleted(options, response);
139
+ const res : carriers.CopilotDataSourceEntity = converters.Create_CopilotDataSourceEntity_From( response.data );
140
+ resolve(res);
141
+ }
142
+ catch( err ) {
143
+ base.WebApiBase.HandleError(options, config, err);
144
+ reject(err);
145
+ }
146
+ });
147
+ }
148
+ /**
149
+ * Replace the existing CopilotDataSourceEntity or creates a new CopilotDataSourceEntity if the id parameter is empty
150
+ * @param entity - The CopilotDataSourceEntity to be saved.
151
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
152
+ * @returns New or updated CopilotDataSourceEntity
153
+ */
154
+ public async saveCopilotDataSourceEntityAsync(entity: carriers.CopilotDataSourceEntity, options?:base.WebApiRequestOptions) : Promise< carriers.CopilotDataSourceEntity > {
155
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
156
+ base.WebApiBase.SetPending(options);
157
+ return new Promise< carriers.CopilotDataSourceEntity >(async (resolve, reject) => {
158
+ try {
159
+ const response = await this._axios.post("SaveCopilotDataSourceEntity", entity, config);
160
+ base.WebApiBase.SetCompleted(options, response);
161
+ const res : carriers.CopilotDataSourceEntity = converters.Create_CopilotDataSourceEntity_From( response.data );
162
+ resolve(res);
163
+ }
164
+ catch( err ) {
165
+ base.WebApiBase.HandleError(options, config, err);
166
+ reject(err);
167
+ }
168
+ });
169
+ }
170
+
171
+ /**
172
+ * Deletes the CopilotDataSourceEntity
173
+ * @param CopilotDataSourceEntityId - The id of the CopilotDataSourceEntity to be deleted.
174
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
175
+ */
176
+ public async deleteCopilotDataSourceEntityAsync(CopilotDataSourceEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
177
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
178
+ base.WebApiBase.SetPending(options);
179
+ return new Promise< void >(async (resolve, reject) => {
180
+ try {
181
+ const response = await this._axios.post("DeleteCopilotDataSourceEntity?CopilotDataSourceEntityId=" + CopilotDataSourceEntityId, null, config );
182
+ base.WebApiBase.SetCompleted(options, response);
183
+ const res = response.data;
184
+ resolve(res);
185
+ }
186
+ catch( err ) {
187
+ base.WebApiBase.HandleError(options, config, err);
188
+ reject(err);
189
+ }
190
+ });
191
+ }
192
+
193
+ /**
194
+ * Set default values into a new CopilotEntity.
195
+ * NetServer calculates default values on the entity, which is required when creating/storing a new instance
196
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
197
+ * @returns A blank entity.
198
+ */
199
+ public async createDefaultCopilotEntityAsync(options?:base.WebApiRequestOptions) : Promise< carriers.CopilotEntity > {
200
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
201
+ base.WebApiBase.SetPending(options);
202
+ return new Promise< carriers.CopilotEntity >(async (resolve, reject) => {
203
+ try {
204
+ const response = await this._axios.post("CreateDefaultCopilotEntity", null, config);
205
+ base.WebApiBase.SetCompleted(options, response);
206
+ const res : carriers.CopilotEntity = converters.Create_CopilotEntity_From( response.data );
207
+ resolve(res);
208
+ }
209
+ catch( err ) {
210
+ base.WebApiBase.HandleError(options, config, err);
211
+ reject(err);
212
+ }
213
+ });
214
+ }
215
+ /**
216
+ * Replace the existing CopilotEntity or creates a new CopilotEntity if the id parameter is empty
217
+ * @param entity - The CopilotEntity to be saved.
218
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
219
+ * @returns New or updated CopilotEntity
220
+ */
221
+ public async saveCopilotEntityAsync(entity: carriers.CopilotEntity, options?:base.WebApiRequestOptions) : Promise< carriers.CopilotEntity > {
222
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
223
+ base.WebApiBase.SetPending(options);
224
+ return new Promise< carriers.CopilotEntity >(async (resolve, reject) => {
225
+ try {
226
+ const response = await this._axios.post("SaveCopilotEntity", entity, config);
227
+ base.WebApiBase.SetCompleted(options, response);
228
+ const res : carriers.CopilotEntity = converters.Create_CopilotEntity_From( response.data );
229
+ resolve(res);
230
+ }
231
+ catch( err ) {
232
+ base.WebApiBase.HandleError(options, config, err);
233
+ reject(err);
234
+ }
235
+ });
236
+ }
237
+
238
+ /**
239
+ * Deletes the CopilotEntity
240
+ * @param CopilotEntityId - The id of the CopilotEntity to be deleted.
241
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
242
+ */
243
+ public async deleteCopilotEntityAsync(CopilotEntityId: number, options?:base.WebApiRequestOptions) : Promise< void > {
244
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
245
+ base.WebApiBase.SetPending(options);
246
+ return new Promise< void >(async (resolve, reject) => {
247
+ try {
248
+ const response = await this._axios.post("DeleteCopilotEntity?CopilotEntityId=" + CopilotEntityId, null, config );
249
+ base.WebApiBase.SetCompleted(options, response);
250
+ const res = response.data;
251
+ resolve(res);
252
+ }
253
+ catch( err ) {
254
+ base.WebApiBase.HandleError(options, config, err);
255
+ reject(err);
256
+ }
257
+ });
258
+ }
259
+
260
+ private async _summarizeTextAsync(request: carriers.AI_SummarizeTextRequest, options?:base.WebApiRequestOptions) : Promise< string > {
261
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
262
+ base.WebApiBase.SetPending(options);
263
+ return new Promise< string >(async (resolve, reject) => {
264
+ try {
265
+ config.baseURL = this._options.baseUrl;
266
+ const response = await this._axios.post("SummarizeText", request , config);
267
+ base.WebApiBase.SetCompleted(options, response);
268
+ const res : string = response.data as string;
269
+ resolve(res);
270
+ }
271
+ catch( err ) {
272
+ base.WebApiBase.HandleError(options, config, err);
273
+ reject(err);
274
+ }
275
+ });
276
+ }
277
+
278
+
279
+
280
+ /**
281
+ * Generate a short summary of a text
282
+ * @param request - Text, PercentSmaller, IsoLangCode
283
+ * @returns Short summary of the text
284
+ */
285
+ public async summarizeTextAsync(request: carriers.AI_SummarizeTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
286
+
287
+ /**
288
+ * Generate a short summary of a text
289
+ * @param text - Text to summarize
290
+ * @param percentSmaller - How much to shorten.
291
+ * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
292
+ * @returns Short summary of the text
293
+ */
294
+ public async summarizeTextAsync(text: string, percentSmaller: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
295
+
296
+ public async summarizeTextAsync(text:string|carriers.AI_SummarizeTextRequest, percentSmaller?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
297
+ let _request : carriers.AI_SummarizeTextRequest = null;
298
+ let _options : base.WebApiRequestOptions = null;
299
+ const first : any = text;
300
+ if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.percentSmaller)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
301
+ {
302
+ _request = text as carriers.AI_SummarizeTextRequest;
303
+ _options = percentSmaller as base.WebApiRequestOptions;
304
+ }
305
+ else
306
+ {
307
+ _request = {
308
+ text: text as string,
309
+ percentSmaller: percentSmaller as number,
310
+ isoLangCode: isoLangCode as string,
311
+ };
312
+ _options = webapi_options;
313
+ }
314
+ return this._summarizeTextAsync( _request, _options );
315
+ }
316
+
317
+
318
+ private async _expandTextAsync(request: carriers.AI_ExpandTextRequest, options?:base.WebApiRequestOptions) : Promise< string > {
319
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
320
+ base.WebApiBase.SetPending(options);
321
+ return new Promise< string >(async (resolve, reject) => {
322
+ try {
323
+ config.baseURL = this._options.baseUrl;
324
+ const response = await this._axios.post("ExpandText", request , config);
325
+ base.WebApiBase.SetCompleted(options, response);
326
+ const res : string = response.data as string;
327
+ resolve(res);
328
+ }
329
+ catch( err ) {
330
+ base.WebApiBase.HandleError(options, config, err);
331
+ reject(err);
332
+ }
333
+ });
334
+ }
335
+
336
+
337
+
338
+ /**
339
+ * Generate a longer version of a text
340
+ * @param request - Text, PercentBigger, IsoLangCode
341
+ * @returns Expanded version of the text
342
+ */
343
+ public async expandTextAsync(request: carriers.AI_ExpandTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
344
+
345
+ /**
346
+ * Generate a longer version of a text
347
+ * @param text - Text to embiggen
348
+ * @param percentBigger - How much to embiggen.
349
+ * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
350
+ * @returns Expanded version of the text
351
+ */
352
+ public async expandTextAsync(text: string, percentBigger: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
353
+
354
+ public async expandTextAsync(text:string|carriers.AI_ExpandTextRequest, percentBigger?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
355
+ let _request : carriers.AI_ExpandTextRequest = null;
356
+ let _options : base.WebApiRequestOptions = null;
357
+ const first : any = text;
358
+ if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.percentBigger)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
359
+ {
360
+ _request = text as carriers.AI_ExpandTextRequest;
361
+ _options = percentBigger as base.WebApiRequestOptions;
362
+ }
363
+ else
364
+ {
365
+ _request = {
366
+ text: text as string,
367
+ percentBigger: percentBigger as number,
368
+ isoLangCode: isoLangCode as string,
369
+ };
370
+ _options = webapi_options;
371
+ }
372
+ return this._expandTextAsync( _request, _options );
373
+ }
374
+
375
+
376
+ private async _rephraseTextAsync(request: carriers.AI_RephraseTextRequest, options?:base.WebApiRequestOptions) : Promise< string > {
377
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
378
+ base.WebApiBase.SetPending(options);
379
+ return new Promise< string >(async (resolve, reject) => {
380
+ try {
381
+ config.baseURL = this._options.baseUrl;
382
+ const response = await this._axios.post("RephraseText", request , config);
383
+ base.WebApiBase.SetCompleted(options, response);
384
+ const res : string = response.data as string;
385
+ resolve(res);
386
+ }
387
+ catch( err ) {
388
+ base.WebApiBase.HandleError(options, config, err);
389
+ reject(err);
390
+ }
391
+ });
392
+ }
393
+
394
+
395
+
396
+ /**
397
+ * Generate a new version of a text
398
+ * @param request - Text, Style, IsoLangCode
399
+ * @returns New version of the text
400
+ */
401
+ public async rephraseTextAsync(request: carriers.AI_RephraseTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
402
+
403
+ /**
404
+ * Generate a new version of a text
405
+ * @param text - Text to transform
406
+ * @param style - New style to transform text into (Rephrase, Correct, Casual, Formal)
407
+ * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
408
+ * @returns New version of the text
409
+ */
410
+ public async rephraseTextAsync(text: string, style: enums.AiTextStyle, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
411
+
412
+ public async rephraseTextAsync(text:string|carriers.AI_RephraseTextRequest, style?:enums.AiTextStyle|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
413
+ let _request : carriers.AI_RephraseTextRequest = null;
414
+ let _options : base.WebApiRequestOptions = null;
415
+ const first : any = text;
416
+ if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.style)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
417
+ {
418
+ _request = text as carriers.AI_RephraseTextRequest;
419
+ _options = style as base.WebApiRequestOptions;
420
+ }
421
+ else
422
+ {
423
+ _request = {
424
+ text: text as string,
425
+ style: style as enums.AiTextStyle,
426
+ isoLangCode: isoLangCode as string,
427
+ };
428
+ _options = webapi_options;
429
+ }
430
+ return this._rephraseTextAsync( _request, _options );
431
+ }
432
+
433
+
434
+ private async _createTextForAppointmentAsync(request: carriers.AI_CreateTextForAppointmentRequest, options?:base.WebApiRequestOptions) : Promise< string > {
435
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
436
+ base.WebApiBase.SetPending(options);
437
+ return new Promise< string >(async (resolve, reject) => {
438
+ try {
439
+ config.baseURL = this._options.baseUrl;
440
+ const response = await this._axios.post("CreateTextForAppointment", request , config);
441
+ base.WebApiBase.SetCompleted(options, response);
442
+ const res : string = response.data as string;
443
+ resolve(res);
444
+ }
445
+ catch( err ) {
446
+ base.WebApiBase.HandleError(options, config, err);
447
+ reject(err);
448
+ }
449
+ });
450
+ }
451
+
452
+
453
+
454
+ /**
455
+ * Generate agenda text for an appointment based on appointment&apos;s company category, title, person, etc.
456
+ * @param request - Appointment, IsoLangCode
457
+ * @returns Agenda text in markdown format
458
+ */
459
+ public async createTextForAppointmentAsync(request: carriers.AI_CreateTextForAppointmentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
460
+
461
+ /**
462
+ * Generate agenda text for an appointment based on appointment&apos;s company category, title, person, etc.
463
+ * @param appointment - The appointment object to generate text for.
464
+ * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
465
+ * @returns Agenda text in markdown format
466
+ */
467
+ public async createTextForAppointmentAsync(appointment: carriers.AppointmentEntity, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
468
+
469
+ public async createTextForAppointmentAsync(appointment:carriers.AppointmentEntity|carriers.AI_CreateTextForAppointmentRequest, isoLangCode?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
470
+ let _request : carriers.AI_CreateTextForAppointmentRequest = null;
471
+ let _options : base.WebApiRequestOptions = null;
472
+ const first : any = appointment;
473
+ if( typeof( first ) === "object" && first && ( typeof(first.appointment)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
474
+ {
475
+ _request = appointment as carriers.AI_CreateTextForAppointmentRequest;
476
+ _options = isoLangCode as base.WebApiRequestOptions;
477
+ }
478
+ else
479
+ {
480
+ _request = {
481
+ appointment: appointment as carriers.AppointmentEntity,
482
+ isoLangCode: isoLangCode as string,
483
+ };
484
+ _options = webapi_options;
485
+ }
486
+ return this._createTextForAppointmentAsync( _request, _options );
487
+ }
488
+
489
+
490
+ private async _analyzeBizCardImageAsync(request: carriers.AI_AnalyzeBizCardImageRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
491
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
492
+ base.WebApiBase.SetPending(options);
493
+ return new Promise< carriers.BizCard >(async (resolve, reject) => {
494
+ try {
495
+ config.baseURL = this._options.baseUrl;
496
+ const response = await this._axios.post("AnalyzeBizCardImage", request , config);
497
+ base.WebApiBase.SetCompleted(options, response);
498
+ const res : carriers.BizCard = converters.Create_BizCard_From( response.data );
499
+ resolve(res);
500
+ }
501
+ catch( err ) {
502
+ base.WebApiBase.HandleError(options, config, err);
503
+ reject(err);
504
+ }
505
+ });
506
+ }
507
+
508
+
509
+
510
+ /**
511
+ * Returns contact and person information from an image. Merges results with matching database records if merge = true
512
+ * @param request - Image, MergeWithDatabase
513
+ * @returns Returns a Contact and a Person entity.
514
+ */
515
+ public async analyzeBizCardImageAsync(request: carriers.AI_AnalyzeBizCardImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
516
+
517
+ /**
518
+ * Returns contact and person information from an image. Merges results with matching database records if merge = true
519
+ * @param image - Image data containg a business card
520
+ * @param mergeWithDatabase - Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities.
521
+ * @returns Returns a Contact and a Person entity.
522
+ */
523
+ public async analyzeBizCardImageAsync(image: ArrayBuffer|string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
524
+
525
+ public async analyzeBizCardImageAsync(image:ArrayBuffer|string|carriers.AI_AnalyzeBizCardImageRequest, mergeWithDatabase?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
526
+ let _request : carriers.AI_AnalyzeBizCardImageRequest = null;
527
+ let _options : base.WebApiRequestOptions = null;
528
+ const first : any = image;
529
+ if( typeof( first ) === "object" && first && ( typeof(first.image)!='undefined' || typeof(first.mergeWithDatabase)!='undefined' ) )
530
+ {
531
+ _request = image as carriers.AI_AnalyzeBizCardImageRequest;
532
+ _options = mergeWithDatabase as base.WebApiRequestOptions;
533
+ }
534
+ else
535
+ {
536
+ _request = {
537
+ image: image as ArrayBuffer|string,
538
+ mergeWithDatabase: mergeWithDatabase as boolean,
539
+ };
540
+ _options = webapi_options;
541
+ }
542
+ _request.image = ToBase64(_request.image);
543
+ return this._analyzeBizCardImageAsync( _request, _options );
544
+ }
545
+
546
+
547
+ private async _analyzeBizCardTextAsync(request: carriers.AI_AnalyzeBizCardTextRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
548
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
549
+ base.WebApiBase.SetPending(options);
550
+ return new Promise< carriers.BizCard >(async (resolve, reject) => {
551
+ try {
552
+ config.baseURL = this._options.baseUrl;
553
+ const response = await this._axios.post("AnalyzeBizCardText", request , config);
554
+ base.WebApiBase.SetCompleted(options, response);
555
+ const res : carriers.BizCard = converters.Create_BizCard_From( response.data );
556
+ resolve(res);
557
+ }
558
+ catch( err ) {
559
+ base.WebApiBase.HandleError(options, config, err);
560
+ reject(err);
561
+ }
562
+ });
563
+ }
564
+
565
+
566
+
567
+ /**
568
+ * Extract contact and person information from text. Merge results with matching database records if merge = true
569
+ * @param request - Text, MergeWithDatabase
570
+ * @returns Returns a Contact and a Person entity.
571
+ */
572
+ public async analyzeBizCardTextAsync(request: carriers.AI_AnalyzeBizCardTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
573
+
574
+ /**
575
+ * Extract contact and person information from text. Merge results with matching database records if merge = true
576
+ * @param text - Text that contains useful contact and person information.
577
+ * @param mergeWithDatabase - Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities.
578
+ * @returns Returns a Contact and a Person entity.
579
+ */
580
+ public async analyzeBizCardTextAsync(text: string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
581
+
582
+ public async analyzeBizCardTextAsync(text:string|carriers.AI_AnalyzeBizCardTextRequest, mergeWithDatabase?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
583
+ let _request : carriers.AI_AnalyzeBizCardTextRequest = null;
584
+ let _options : base.WebApiRequestOptions = null;
585
+ const first : any = text;
586
+ if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.mergeWithDatabase)!='undefined' ) )
587
+ {
588
+ _request = text as carriers.AI_AnalyzeBizCardTextRequest;
589
+ _options = mergeWithDatabase as base.WebApiRequestOptions;
590
+ }
591
+ else
592
+ {
593
+ _request = {
594
+ text: text as string,
595
+ mergeWithDatabase: mergeWithDatabase as boolean,
596
+ };
597
+ _options = webapi_options;
598
+ }
599
+ return this._analyzeBizCardTextAsync( _request, _options );
600
+ }
601
+
602
+
603
+ private async _getTrainingStatusAsync( options?:base.WebApiRequestOptions) : Promise< carriers.CategorizationStatusResponse > {
604
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
605
+ base.WebApiBase.SetPending(options);
606
+ return new Promise< carriers.CategorizationStatusResponse >(async (resolve, reject) => {
607
+ try {
608
+ config.baseURL = this._options.baseUrl;
609
+ const response = await this._axios.post("GetTrainingStatus", undefined , config);
610
+ base.WebApiBase.SetCompleted(options, response);
611
+ const res : carriers.CategorizationStatusResponse = converters.Create_CategorizationStatusResponse_From( response.data );
612
+ resolve(res);
613
+ }
614
+ catch( err ) {
615
+ base.WebApiBase.HandleError(options, config, err);
616
+ reject(err);
617
+ }
618
+ });
619
+ }
620
+
621
+
622
+ /**
623
+ * Calling the HugoAI endpoint to fetch the current training status.
624
+ * @returns Carrier to describe the current status of HugoAI categorization
625
+ */
626
+ public async getTrainingStatusAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CategorizationStatusResponse >
627
+ {
628
+ return this._getTrainingStatusAsync(webapi_options);
629
+ }
630
+
631
+
632
+ private async _guessCategoryAsync(request: carriers.AI_GuessCategoryRequest, options?:base.WebApiRequestOptions) : Promise< number > {
633
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
634
+ base.WebApiBase.SetPending(options);
635
+ return new Promise< number >(async (resolve, reject) => {
636
+ try {
637
+ config.baseURL = this._options.baseUrl;
638
+ const response = await this._axios.post("GuessCategory", request , config);
639
+ base.WebApiBase.SetCompleted(options, response);
640
+ const res : number = response.data as number;
641
+ resolve(res);
642
+ }
643
+ catch( err ) {
644
+ base.WebApiBase.HandleError(options, config, err);
645
+ reject(err);
646
+ }
647
+ });
648
+ }
649
+
650
+
651
+
652
+ /**
653
+ * Given a ticket&apos;s id, guess the ticket category it should be placed in. Currently this is based on the first message in the ticket
654
+ * @param request - TicketId
655
+ * @returns Suggested ticket category ID
656
+ */
657
+ public async guessCategoryAsync(request: carriers.AI_GuessCategoryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
658
+
659
+ /**
660
+ * Given a ticket&apos;s id, guess the ticket category it should be placed in. Currently this is based on the first message in the ticket
661
+ * @param ticketId - Id of ticket to guess category for
662
+ * @returns Suggested ticket category ID
663
+ */
664
+ public async guessCategoryAsync(ticketId: number, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
665
+
666
+ public async guessCategoryAsync(ticketId:number|carriers.AI_GuessCategoryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
667
+ let _request : carriers.AI_GuessCategoryRequest = null;
668
+ let _options : base.WebApiRequestOptions = null;
669
+ const first : any = ticketId;
670
+ if( typeof( first ) === "object" && first && ( typeof(first.ticketId)!='undefined' ) )
671
+ {
672
+ _request = ticketId as carriers.AI_GuessCategoryRequest;
673
+ _options = webapi_options as base.WebApiRequestOptions;
674
+ }
675
+ else
676
+ {
677
+ _request = {
678
+ ticketId: ticketId as number,
679
+ };
680
+ _options = webapi_options;
681
+ }
682
+ return this._guessCategoryAsync( _request, _options );
683
+ }
684
+
685
+
686
+ private async _trainCategoryGuesserAsync(request: carriers.AI_TrainCategoryGuesserRequest, options?:base.WebApiRequestOptions) : Promise< string > {
687
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
688
+ base.WebApiBase.SetPending(options);
689
+ return new Promise< string >(async (resolve, reject) => {
690
+ try {
691
+ config.baseURL = this._options.baseUrl;
692
+ const response = await this._axios.post("TrainCategoryGuesser", request , config);
693
+ base.WebApiBase.SetCompleted(options, response);
694
+ const res : string = response.data as string;
695
+ resolve(res);
696
+ }
697
+ catch( err ) {
698
+ base.WebApiBase.HandleError(options, config, err);
699
+ reject(err);
700
+ }
701
+ });
702
+ }
703
+
704
+
705
+
706
+ /**
707
+ * The category guesser training API will be called with an array of CategorizationTrainingItem during the (background, Batch) execution of this call
708
+ * @param request - SelectionId, MaxItems, MaxTextLength
709
+ * @returns Placeholder for result... should this be a BatchTaskId? maybe not useful?
710
+ */
711
+ public async trainCategoryGuesserAsync(request: carriers.AI_TrainCategoryGuesserRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
712
+
713
+ /**
714
+ * The category guesser training API will be called with an array of CategorizationTrainingItem during the (background, Batch) execution of this call
715
+ * @param selectionId - Id of selection of tickets, to retrieve training data from
716
+ * @param maxItems - Maximum number of tickets to retrieve data from
717
+ * @param maxTextLength - Maximum length of PlainTextBody or any other large text, truncated to nearest word boundary
718
+ * @returns Placeholder for result... should this be a BatchTaskId? maybe not useful?
719
+ */
720
+ public async trainCategoryGuesserAsync(selectionId: number, maxItems: number, maxTextLength: number, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
721
+
722
+ public async trainCategoryGuesserAsync(selectionId:number|carriers.AI_TrainCategoryGuesserRequest, maxItems?:number|base.WebApiRequestOptions, maxTextLength?:number, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
723
+ let _request : carriers.AI_TrainCategoryGuesserRequest = null;
724
+ let _options : base.WebApiRequestOptions = null;
725
+ const first : any = selectionId;
726
+ if( typeof( first ) === "object" && first && ( typeof(first.selectionId)!='undefined' || typeof(first.maxItems)!='undefined' || typeof(first.maxTextLength)!='undefined' ) )
727
+ {
728
+ _request = selectionId as carriers.AI_TrainCategoryGuesserRequest;
729
+ _options = maxItems as base.WebApiRequestOptions;
730
+ }
731
+ else
732
+ {
733
+ _request = {
734
+ selectionId: selectionId as number,
735
+ maxItems: maxItems as number,
736
+ maxTextLength: maxTextLength as number,
737
+ };
738
+ _options = webapi_options;
739
+ }
740
+ return this._trainCategoryGuesserAsync( _request, _options );
741
+ }
742
+
743
+
744
+ private async _getChatbotResponseAsync(request: carriers.AI_GetChatbotResponseRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
745
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
746
+ base.WebApiBase.SetPending(options);
747
+ return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
748
+ try {
749
+ config.baseURL = this._options.baseUrl;
750
+ const response = await this._axios.post("GetChatbotResponse", request , config);
751
+ base.WebApiBase.SetCompleted(options, response);
752
+ const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
753
+ resolve(res);
754
+ }
755
+ catch( err ) {
756
+ base.WebApiBase.HandleError(options, config, err);
757
+ reject(err);
758
+ }
759
+ });
760
+ }
761
+
762
+
763
+
764
+ /**
765
+ * Return a chatbot response given prompt and previous turns. Stores the new turn in the history for the chatId
766
+ * @param request - ChatId, IsoLangCode, UserPrompt, DisplayValue, PreviousTurns, ApiUrl
767
+ * @returns Returns new turn that client can append to its local history.
768
+ */
769
+ public async getChatbotResponseAsync(request: carriers.AI_GetChatbotResponseRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
770
+
771
+ /**
772
+ * Return a chatbot response given prompt and previous turns. Stores the new turn in the history for the chatId
773
+ * @param chatId - identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary)
774
+ * @param isoLangCode - ISO2 Language code ('en', 'no', 'de'...) for suggestions in response
775
+ * @param userPrompt - User question for chatbot
776
+ * @param displayValue - User question for display - optional - null = use userPrompt
777
+ * @param previousTurns - Chat history - all previous turns in chronological order
778
+ * @param apiUrl - CRM API endpoint URL for chatbot to make callbacks to. 'https://example.com/superoffice/api/'
779
+ * @returns Returns new turn that client can append to its local history.
780
+ */
781
+ public async getChatbotResponseAsync(chatId: string, isoLangCode: string, userPrompt: string, displayValue: string, previousTurns: carriers.ChatbotTurn[], apiUrl: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
782
+
783
+ public async getChatbotResponseAsync(chatId:string|carriers.AI_GetChatbotResponseRequest, isoLangCode?:string|base.WebApiRequestOptions, userPrompt?:string, displayValue?:string, previousTurns?:carriers.ChatbotTurn[], apiUrl?:string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
784
+ let _request : carriers.AI_GetChatbotResponseRequest = null;
785
+ let _options : base.WebApiRequestOptions = null;
786
+ const first : any = chatId;
787
+ if( typeof( first ) === "object" && first && ( typeof(first.chatId)!='undefined' || typeof(first.isoLangCode)!='undefined' || typeof(first.userPrompt)!='undefined' || typeof(first.displayValue)!='undefined' || typeof(first.previousTurns)!='undefined' || typeof(first.apiUrl)!='undefined' ) )
788
+ {
789
+ _request = chatId as carriers.AI_GetChatbotResponseRequest;
790
+ _options = isoLangCode as base.WebApiRequestOptions;
791
+ }
792
+ else
793
+ {
794
+ _request = {
795
+ chatId: chatId as string,
796
+ isoLangCode: isoLangCode as string,
797
+ userPrompt: userPrompt as string,
798
+ displayValue: displayValue as string,
799
+ previousTurns: previousTurns as carriers.ChatbotTurn[],
800
+ apiUrl: apiUrl as string,
801
+ };
802
+ _options = webapi_options;
803
+ }
804
+ return this._getChatbotResponseAsync( _request, _options );
805
+ }
806
+
807
+
808
+ private async _getChatbotPromptSuggestionsAsync(request: carriers.AI_GetChatbotPromptSuggestionsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
809
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
810
+ base.WebApiBase.SetPending(options);
811
+ return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
812
+ try {
813
+ config.baseURL = this._options.baseUrl;
814
+ const response = await this._axios.post("GetChatbotPromptSuggestions", request , config);
815
+ base.WebApiBase.SetCompleted(options, response);
816
+ const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
817
+ resolve(res);
818
+ }
819
+ catch( err ) {
820
+ base.WebApiBase.HandleError(options, config, err);
821
+ reject(err);
822
+ }
823
+ });
824
+ }
825
+
826
+
827
+
828
+ /**
829
+ * Return one or more suggested prompts as actions to display in an empty chat window
830
+ * @param request - IsoLangCode, SoProtocol, CurrentId
831
+ * @returns Contains zero or more BotActions, and welcome message in Bot response
832
+ */
833
+ public async getChatbotPromptSuggestionsAsync(request: carriers.AI_GetChatbotPromptSuggestionsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
834
+
835
+ /**
836
+ * Return one or more suggested prompts as actions to display in an empty chat window
837
+ * @param isoLangCode - ISO2 Language code ('en', 'no', 'de'...) for suggestions in response
838
+ * @param soProtocol - Context for suggestions ('contact.main.activities')
839
+ * @param currentId - current company/person/project id - used for context in suggestions
840
+ * @returns Contains zero or more BotActions, and welcome message in Bot response
841
+ */
842
+ public async getChatbotPromptSuggestionsAsync(isoLangCode: string, soProtocol: string, currentId: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
843
+
844
+ public async getChatbotPromptSuggestionsAsync(isoLangCode:string|carriers.AI_GetChatbotPromptSuggestionsRequest, soProtocol?:string|base.WebApiRequestOptions, currentId?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
845
+ let _request : carriers.AI_GetChatbotPromptSuggestionsRequest = null;
846
+ let _options : base.WebApiRequestOptions = null;
847
+ const first : any = isoLangCode;
848
+ if( typeof( first ) === "object" && first && ( typeof(first.isoLangCode)!='undefined' || typeof(first.soProtocol)!='undefined' || typeof(first.currentId)!='undefined' ) )
849
+ {
850
+ _request = isoLangCode as carriers.AI_GetChatbotPromptSuggestionsRequest;
851
+ _options = soProtocol as base.WebApiRequestOptions;
852
+ }
853
+ else
854
+ {
855
+ _request = {
856
+ isoLangCode: isoLangCode as string,
857
+ soProtocol: soProtocol as string,
858
+ currentId: currentId as number,
859
+ };
860
+ _options = webapi_options;
861
+ }
862
+ return this._getChatbotPromptSuggestionsAsync( _request, _options );
863
+ }
864
+
865
+
866
+ private async _getChatbotTurnsAsync(request: carriers.AI_GetChatbotTurnsRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] > {
867
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
868
+ base.WebApiBase.SetPending(options);
869
+ return new Promise< carriers.ChatbotTurn[] >(async (resolve, reject) => {
870
+ try {
871
+ config.baseURL = this._options.baseUrl;
872
+ const response = await this._axios.post("GetChatbotTurns", request , config);
873
+ base.WebApiBase.SetCompleted(options, response);
874
+ const res : carriers.ChatbotTurn[] = converters.Create_ChatbotTurnArray_From( response.data );
875
+ resolve(res);
876
+ }
877
+ catch( err ) {
878
+ base.WebApiBase.HandleError(options, config, err);
879
+ reject(err);
880
+ }
881
+ });
882
+ }
883
+
884
+
885
+
886
+ /**
887
+ * Returns stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name.
888
+ * @param request - ChatId
889
+ * @returns Array containing zero or more turns. If you got zero turns, call GetChatbotPromptSuggestions to get an initial turn from the bot.
890
+ */
891
+ public async getChatbotTurnsAsync(request: carriers.AI_GetChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] >;
892
+
893
+ /**
894
+ * Returns stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name.
895
+ * @param chatId - identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary)
896
+ * @returns Array containing zero or more turns. If you got zero turns, call GetChatbotPromptSuggestions to get an initial turn from the bot.
897
+ */
898
+ public async getChatbotTurnsAsync(chatId: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] >;
899
+
900
+ public async getChatbotTurnsAsync(chatId:string|carriers.AI_GetChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn[] > {
901
+ let _request : carriers.AI_GetChatbotTurnsRequest = null;
902
+ let _options : base.WebApiRequestOptions = null;
903
+ const first : any = chatId;
904
+ if( typeof( first ) === "object" && first && ( typeof(first.chatId)!='undefined' ) )
905
+ {
906
+ _request = chatId as carriers.AI_GetChatbotTurnsRequest;
907
+ _options = webapi_options as base.WebApiRequestOptions;
908
+ }
909
+ else
910
+ {
911
+ _request = {
912
+ chatId: chatId as string,
913
+ };
914
+ _options = webapi_options;
915
+ }
916
+ return this._getChatbotTurnsAsync( _request, _options );
917
+ }
918
+
919
+
920
+ private async _clearChatbotTurnsAsync(request: carriers.AI_ClearChatbotTurnsRequest, options?:base.WebApiRequestOptions) : Promise< void > {
921
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
922
+ base.WebApiBase.SetPending(options);
923
+ return new Promise< void >(async (resolve, reject) => {
924
+ try {
925
+ config.baseURL = this._options.baseUrl;
926
+ const response = await this._axios.post("ClearChatbotTurns", request , config);
927
+ base.WebApiBase.SetCompleted(options, response);
928
+ const res = response.data;
929
+ resolve(res);
930
+ }
931
+ catch( err ) {
932
+ base.WebApiBase.HandleError(options, config, err);
933
+ reject(err);
934
+ }
935
+ });
936
+ }
937
+
938
+
939
+
940
+ /**
941
+ * Clears the stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name
942
+ * @param request - ChatId
943
+ * @returns This method has no return value
944
+ */
945
+ public async clearChatbotTurnsAsync(request: carriers.AI_ClearChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
946
+
947
+ /**
948
+ * Clears the stored history of chat messages for a given chat_id. Chat_id is usually derived from soproto + current id, but could also be arbitrary name
949
+ * @param chatId - identifies this chat = arbitrary name (e.g. user-defined) or the soprotocol + id (e.g. ticket-123, contact-43, diary)
950
+ * @returns This method has no return value
951
+ */
952
+ public async clearChatbotTurnsAsync(chatId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
953
+
954
+ public async clearChatbotTurnsAsync(chatId:string|carriers.AI_ClearChatbotTurnsRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
955
+ let _request : carriers.AI_ClearChatbotTurnsRequest = null;
956
+ let _options : base.WebApiRequestOptions = null;
957
+ const first : any = chatId;
958
+ if( typeof( first ) === "object" && first && ( typeof(first.chatId)!='undefined' ) )
959
+ {
960
+ _request = chatId as carriers.AI_ClearChatbotTurnsRequest;
961
+ _options = webapi_options as base.WebApiRequestOptions;
962
+ }
963
+ else
964
+ {
965
+ _request = {
966
+ chatId: chatId as string,
967
+ };
968
+ _options = webapi_options;
969
+ }
970
+ return this._clearChatbotTurnsAsync( _request, _options );
971
+ }
972
+
973
+ /**
974
+ * Gets a CopilotDataSourceEntity object.
975
+ * @param copilotDataSourceEntityId - The primary key.
976
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
977
+ * @returns A single CopilotDataSourceEntity
978
+ */
979
+ public async getCopilotDataSourceEntityAsync(copilotDataSourceEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.CopilotDataSourceEntity > {
980
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
981
+ base.WebApiBase.SetPending(options);
982
+ return new Promise< carriers.CopilotDataSourceEntity >(async (resolve, reject) => {
983
+ try {
984
+ const response = await this._axios.post("GetCopilotDataSourceEntity?copilotDataSourceEntityId=" + copilotDataSourceEntityId, null, config);
985
+ base.WebApiBase.SetCompleted(options, response);
986
+ const res = converters.Create_CopilotDataSourceEntity_From( response.data );
987
+ resolve(res);
988
+ }
989
+ catch( err ) {
990
+ base.WebApiBase.HandleError(options, config, err);
991
+ reject(err);
992
+ }
993
+ });
994
+ }
995
+
996
+ /**
997
+ * Gets a CopilotEntity object.
998
+ * @param copilotEntityId - The primary key.
999
+ * @param options - Override language/culture codes on this request. Provide cancellation and request status values.
1000
+ * @returns A single CopilotEntity
1001
+ */
1002
+ public async getCopilotEntityAsync(copilotEntityId: number, options?:base.WebApiRequestOptions) : Promise< carriers.CopilotEntity > {
1003
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1004
+ base.WebApiBase.SetPending(options);
1005
+ return new Promise< carriers.CopilotEntity >(async (resolve, reject) => {
1006
+ try {
1007
+ const response = await this._axios.post("GetCopilotEntity?copilotEntityId=" + copilotEntityId, null, config);
1008
+ base.WebApiBase.SetCompleted(options, response);
1009
+ const res = converters.Create_CopilotEntity_From( response.data );
1010
+ resolve(res);
1011
+ }
1012
+ catch( err ) {
1013
+ base.WebApiBase.HandleError(options, config, err);
1014
+ reject(err);
1015
+ }
1016
+ });
1017
+ }
1018
+
1019
+
1020
+ private async _getFormDesignFromImageAsync(request: carriers.AI_GetFormDesignFromImageRequest, options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1021
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1022
+ base.WebApiBase.SetPending(options);
1023
+ return new Promise< carriers.StringDictionary >(async (resolve, reject) => {
1024
+ try {
1025
+ config.baseURL = this._options.baseUrl;
1026
+ const response = await this._axios.post("GetFormDesignFromImage", request , config);
1027
+ base.WebApiBase.SetCompleted(options, response);
1028
+ const res : carriers.StringDictionary = converters.Create_StringDictionary_From( response.data );
1029
+ resolve(res);
1030
+ }
1031
+ catch( err ) {
1032
+ base.WebApiBase.HandleError(options, config, err);
1033
+ reject(err);
1034
+ }
1035
+ });
1036
+ }
1037
+
1038
+
1039
+
1040
+ /**
1041
+ * Returns Form Designer properties based on the look of a picture
1042
+ * @param request - Image
1043
+ * @returns Returns a Form Designer properties.
1044
+ */
1045
+ public async getFormDesignFromImageAsync(request: carriers.AI_GetFormDesignFromImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1046
+
1047
+ /**
1048
+ * Returns Form Designer properties based on the look of a picture
1049
+ * @param image - Image data to analyze for design
1050
+ * @returns Returns a Form Designer properties.
1051
+ */
1052
+ public async getFormDesignFromImageAsync(image: ArrayBuffer|string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1053
+
1054
+ public async getFormDesignFromImageAsync(image:ArrayBuffer|string|carriers.AI_GetFormDesignFromImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1055
+ let _request : carriers.AI_GetFormDesignFromImageRequest = null;
1056
+ let _options : base.WebApiRequestOptions = null;
1057
+ const first : any = image;
1058
+ if( typeof( first ) === "object" && first && ( typeof(first.image)!='undefined' ) )
1059
+ {
1060
+ _request = image as carriers.AI_GetFormDesignFromImageRequest;
1061
+ _options = webapi_options as base.WebApiRequestOptions;
1062
+ }
1063
+ else
1064
+ {
1065
+ _request = {
1066
+ image: image as ArrayBuffer|string,
1067
+ };
1068
+ _options = webapi_options;
1069
+ }
1070
+ _request.image = ToBase64(_request.image);
1071
+ return this._getFormDesignFromImageAsync( _request, _options );
1072
+ }
1073
+
1074
+
1075
+ private async _getFormDesignFromUrlAsync(request: carriers.AI_GetFormDesignFromUrlRequest, options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1076
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1077
+ base.WebApiBase.SetPending(options);
1078
+ return new Promise< carriers.StringDictionary >(async (resolve, reject) => {
1079
+ try {
1080
+ config.baseURL = this._options.baseUrl;
1081
+ const response = await this._axios.post("GetFormDesignFromUrl", request , config);
1082
+ base.WebApiBase.SetCompleted(options, response);
1083
+ const res : carriers.StringDictionary = converters.Create_StringDictionary_From( response.data );
1084
+ resolve(res);
1085
+ }
1086
+ catch( err ) {
1087
+ base.WebApiBase.HandleError(options, config, err);
1088
+ reject(err);
1089
+ }
1090
+ });
1091
+ }
1092
+
1093
+
1094
+
1095
+ /**
1096
+ * Returns Form Designer properties based on the look of a web page
1097
+ * @param request - Url
1098
+ * @returns Returns a Form Designer properties.
1099
+ */
1100
+ public async getFormDesignFromUrlAsync(request: carriers.AI_GetFormDesignFromUrlRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1101
+
1102
+ /**
1103
+ * Returns Form Designer properties based on the look of a web page
1104
+ * @param url - Url of the web page to extract style from.
1105
+ * @returns Returns a Form Designer properties.
1106
+ */
1107
+ public async getFormDesignFromUrlAsync(url: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary >;
1108
+
1109
+ public async getFormDesignFromUrlAsync(url:string|carriers.AI_GetFormDesignFromUrlRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.StringDictionary > {
1110
+ let _request : carriers.AI_GetFormDesignFromUrlRequest = null;
1111
+ let _options : base.WebApiRequestOptions = null;
1112
+ const first : any = url;
1113
+ if( typeof( first ) === "object" && first && ( typeof(first.url)!='undefined' ) )
1114
+ {
1115
+ _request = url as carriers.AI_GetFormDesignFromUrlRequest;
1116
+ _options = webapi_options as base.WebApiRequestOptions;
1117
+ }
1118
+ else
1119
+ {
1120
+ _request = {
1121
+ url: url as string,
1122
+ };
1123
+ _options = webapi_options;
1124
+ }
1125
+ return this._getFormDesignFromUrlAsync( _request, _options );
1126
+ }
1127
+
1128
+
1129
+ private async _detectLanguageAsync(request: carriers.AI_DetectLanguageRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1130
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1131
+ base.WebApiBase.SetPending(options);
1132
+ return new Promise< string >(async (resolve, reject) => {
1133
+ try {
1134
+ config.baseURL = this._options.baseUrl;
1135
+ const response = await this._axios.post("DetectLanguage", request , config);
1136
+ base.WebApiBase.SetCompleted(options, response);
1137
+ const res : string = response.data as string;
1138
+ resolve(res);
1139
+ }
1140
+ catch( err ) {
1141
+ base.WebApiBase.HandleError(options, config, err);
1142
+ reject(err);
1143
+ }
1144
+ });
1145
+ }
1146
+
1147
+
1148
+
1149
+ /**
1150
+ * Given a (reasonably short) text, detect the language it is written in
1151
+ * @param request - Text
1152
+ * @returns ISO Language code, such as NO, US, ES, FR
1153
+ */
1154
+ public async detectLanguageAsync(request: carriers.AI_DetectLanguageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1155
+
1156
+ /**
1157
+ * Given a (reasonably short) text, detect the language it is written in
1158
+ * @param text - Text to be analyzed; there may be a cost-per-character so do not send a book here
1159
+ * @returns ISO Language code, such as NO, US, ES, FR
1160
+ */
1161
+ public async detectLanguageAsync(text: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1162
+
1163
+ public async detectLanguageAsync(text:string|carriers.AI_DetectLanguageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1164
+ let _request : carriers.AI_DetectLanguageRequest = null;
1165
+ let _options : base.WebApiRequestOptions = null;
1166
+ const first : any = text;
1167
+ if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' ) )
1168
+ {
1169
+ _request = text as carriers.AI_DetectLanguageRequest;
1170
+ _options = webapi_options as base.WebApiRequestOptions;
1171
+ }
1172
+ else
1173
+ {
1174
+ _request = {
1175
+ text: text as string,
1176
+ };
1177
+ _options = webapi_options;
1178
+ }
1179
+ return this._detectLanguageAsync( _request, _options );
1180
+ }
1181
+
1182
+
1183
+ private async _detectSentimentAsync(request: carriers.AI_DetectSentimentRequest, options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment > {
1184
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1185
+ base.WebApiBase.SetPending(options);
1186
+ return new Promise< carriers.Sentiment >(async (resolve, reject) => {
1187
+ try {
1188
+ config.baseURL = this._options.baseUrl;
1189
+ const response = await this._axios.post("DetectSentiment", request , config);
1190
+ base.WebApiBase.SetCompleted(options, response);
1191
+ const res : carriers.Sentiment = converters.Create_Sentiment_From( response.data );
1192
+ resolve(res);
1193
+ }
1194
+ catch( err ) {
1195
+ base.WebApiBase.HandleError(options, config, err);
1196
+ reject(err);
1197
+ }
1198
+ });
1199
+ }
1200
+
1201
+
1202
+
1203
+ /**
1204
+ * Detect the sentiment of a (reasonably short) text. Sentiment analysis may cause a translation to be made, since sentiment analysis only supports a limited set of languages
1205
+ * @param request - Text
1206
+ * @returns The sentiment information: score (-100 to +100) and confidence
1207
+ */
1208
+ public async detectSentimentAsync(request: carriers.AI_DetectSentimentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment >;
1209
+
1210
+ /**
1211
+ * Detect the sentiment of a (reasonably short) text. Sentiment analysis may cause a translation to be made, since sentiment analysis only supports a limited set of languages
1212
+ * @param text - Text to be analyzed
1213
+ * @returns The sentiment information: score (-100 to +100) and confidence
1214
+ */
1215
+ public async detectSentimentAsync(text: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment >;
1216
+
1217
+ public async detectSentimentAsync(text:string|carriers.AI_DetectSentimentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.Sentiment > {
1218
+ let _request : carriers.AI_DetectSentimentRequest = null;
1219
+ let _options : base.WebApiRequestOptions = null;
1220
+ const first : any = text;
1221
+ if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' ) )
1222
+ {
1223
+ _request = text as carriers.AI_DetectSentimentRequest;
1224
+ _options = webapi_options as base.WebApiRequestOptions;
1225
+ }
1226
+ else
1227
+ {
1228
+ _request = {
1229
+ text: text as string,
1230
+ };
1231
+ _options = webapi_options;
1232
+ }
1233
+ return this._detectSentimentAsync( _request, _options );
1234
+ }
1235
+
1236
+
1237
+ private async _translateAsync(request: carriers.AI_TranslateRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1238
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1239
+ base.WebApiBase.SetPending(options);
1240
+ return new Promise< string >(async (resolve, reject) => {
1241
+ try {
1242
+ config.baseURL = this._options.baseUrl;
1243
+ const response = await this._axios.post("Translate", request , config);
1244
+ base.WebApiBase.SetCompleted(options, response);
1245
+ const res : string = response.data as string;
1246
+ resolve(res);
1247
+ }
1248
+ catch( err ) {
1249
+ base.WebApiBase.HandleError(options, config, err);
1250
+ reject(err);
1251
+ }
1252
+ });
1253
+ }
1254
+
1255
+
1256
+
1257
+ /**
1258
+ * Translate a text from one language to another. Language of the text is automatically detected.
1259
+ * @param request - Text, TargetLanguage
1260
+ * @returns Translated text
1261
+ */
1262
+ public async translateAsync(request: carriers.AI_TranslateRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1263
+
1264
+ /**
1265
+ * Translate a text from one language to another. Language of the text is automatically detected.
1266
+ * @param text - Text to be translated. Language of the text is automatically detected.
1267
+ * @param targetLanguage - ISO Language code (such as FR) to translate the text into
1268
+ * @returns Translated text
1269
+ */
1270
+ public async translateAsync(text: string, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1271
+
1272
+ public async translateAsync(text:string|carriers.AI_TranslateRequest, targetLanguage?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1273
+ let _request : carriers.AI_TranslateRequest = null;
1274
+ let _options : base.WebApiRequestOptions = null;
1275
+ const first : any = text;
1276
+ if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.targetLanguage)!='undefined' ) )
1277
+ {
1278
+ _request = text as carriers.AI_TranslateRequest;
1279
+ _options = targetLanguage as base.WebApiRequestOptions;
1280
+ }
1281
+ else
1282
+ {
1283
+ _request = {
1284
+ text: text as string,
1285
+ targetLanguage: targetLanguage as string,
1286
+ };
1287
+ _options = webapi_options;
1288
+ }
1289
+ return this._translateAsync( _request, _options );
1290
+ }
1291
+
1292
+
1293
+ private async _translateEntityAsync(request: carriers.AI_TranslateEntityRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1294
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1295
+ base.WebApiBase.SetPending(options);
1296
+ return new Promise< string >(async (resolve, reject) => {
1297
+ try {
1298
+ config.baseURL = this._options.baseUrl;
1299
+ const response = await this._axios.post("TranslateEntity", request , config);
1300
+ base.WebApiBase.SetCompleted(options, response);
1301
+ const res : string = response.data as string;
1302
+ resolve(res);
1303
+ }
1304
+ catch( err ) {
1305
+ base.WebApiBase.HandleError(options, config, err);
1306
+ reject(err);
1307
+ }
1308
+ });
1309
+ }
1310
+
1311
+
1312
+
1313
+ /**
1314
+ * Retrieve, format and translate text for an entity to a specified language
1315
+ * @param request - EntityName, EntityId, TargetLanguage
1316
+ * @returns Translated text
1317
+ */
1318
+ public async translateEntityAsync(request: carriers.AI_TranslateEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1319
+
1320
+ /**
1321
+ * Retrieve, format and translate text for an entity to a specified language
1322
+ * @param entityName - Name of entity to get the text to be translated; eg., 'ticketMessage'
1323
+ * @param entityId - Identifier for the entity to get text to be translated
1324
+ * @param targetLanguage - ISO Language code (such as FR) to translate the text into
1325
+ * @returns Translated text
1326
+ */
1327
+ public async translateEntityAsync(entityName: string, entityId: number, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1328
+
1329
+ public async translateEntityAsync(entityName:string|carriers.AI_TranslateEntityRequest, entityId?:number|base.WebApiRequestOptions, targetLanguage?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1330
+ let _request : carriers.AI_TranslateEntityRequest = null;
1331
+ let _options : base.WebApiRequestOptions = null;
1332
+ const first : any = entityName;
1333
+ if( typeof( first ) === "object" && first && ( typeof(first.entityName)!='undefined' || typeof(first.entityId)!='undefined' || typeof(first.targetLanguage)!='undefined' ) )
1334
+ {
1335
+ _request = entityName as carriers.AI_TranslateEntityRequest;
1336
+ _options = entityId as base.WebApiRequestOptions;
1337
+ }
1338
+ else
1339
+ {
1340
+ _request = {
1341
+ entityName: entityName as string,
1342
+ entityId: entityId as number,
1343
+ targetLanguage: targetLanguage as string,
1344
+ };
1345
+ _options = webapi_options;
1346
+ }
1347
+ return this._translateEntityAsync( _request, _options );
1348
+ }
1349
+
1350
+
1351
+ private async _answerAsync(request: carriers.AI_AnswerRequest, options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer > {
1352
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1353
+ base.WebApiBase.SetPending(options);
1354
+ return new Promise< carriers.RagAnswer >(async (resolve, reject) => {
1355
+ try {
1356
+ config.baseURL = this._options.baseUrl;
1357
+ const response = await this._axios.post("Answer", request , config);
1358
+ base.WebApiBase.SetCompleted(options, response);
1359
+ const res : carriers.RagAnswer = converters.Create_RagAnswer_From( response.data );
1360
+ resolve(res);
1361
+ }
1362
+ catch( err ) {
1363
+ base.WebApiBase.HandleError(options, config, err);
1364
+ reject(err);
1365
+ }
1366
+ });
1367
+ }
1368
+
1369
+
1370
+
1371
+ /**
1372
+ * Returns an answer.
1373
+ * @param request - NamespaceName, Query, Type, Top
1374
+ * @returns Generated answer based on query.
1375
+ */
1376
+ public async answerAsync(request: carriers.AI_AnswerRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
1377
+
1378
+ /**
1379
+ * Returns an answer.
1380
+ * @param namespaceName - Defines the search domain used for generating answer. e.g. 'ServiceCopilot'
1381
+ * @param query - Question. The search query to answer.
1382
+ * @param type - Filter results based on content type. Default: None = no filtering
1383
+ * @param top - Max Number of results to use in generating answer.
1384
+ * @returns Generated answer based on query.
1385
+ */
1386
+ public async answerAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
1387
+
1388
+ public async answerAsync(namespaceName:string|carriers.AI_AnswerRequest, query?:string|base.WebApiRequestOptions, type?:enums.RagType, top?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer > {
1389
+ let _request : carriers.AI_AnswerRequest = null;
1390
+ let _options : base.WebApiRequestOptions = null;
1391
+ const first : any = namespaceName;
1392
+ if( typeof( first ) === "object" && first && ( typeof(first.namespaceName)!='undefined' || typeof(first.query)!='undefined' || typeof(first.type)!='undefined' || typeof(first.top)!='undefined' ) )
1393
+ {
1394
+ _request = namespaceName as carriers.AI_AnswerRequest;
1395
+ _options = query as base.WebApiRequestOptions;
1396
+ }
1397
+ else
1398
+ {
1399
+ _request = {
1400
+ namespaceName: namespaceName as string,
1401
+ query: query as string,
1402
+ type: type as enums.RagType,
1403
+ top: top as number,
1404
+ };
1405
+ _options = webapi_options;
1406
+ }
1407
+ return this._answerAsync( _request, _options );
1408
+ }
1409
+
1410
+
1411
+ private async _answerFeedbackAsync(request: carriers.AI_AnswerFeedbackRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1412
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1413
+ base.WebApiBase.SetPending(options);
1414
+ return new Promise< void >(async (resolve, reject) => {
1415
+ try {
1416
+ config.baseURL = this._options.baseUrl;
1417
+ const response = await this._axios.post("AnswerFeedback", request , config);
1418
+ base.WebApiBase.SetCompleted(options, response);
1419
+ const res = response.data;
1420
+ resolve(res);
1421
+ }
1422
+ catch( err ) {
1423
+ base.WebApiBase.HandleError(options, config, err);
1424
+ reject(err);
1425
+ }
1426
+ });
1427
+ }
1428
+
1429
+
1430
+
1431
+ /**
1432
+ * Send feedback on answer - feedback is logged and used to improve the answer algorithm.
1433
+ * @param request - TrackingId, IsThumbsUp
1434
+ * @returns This method has no return value
1435
+ */
1436
+ public async answerFeedbackAsync(request: carriers.AI_AnswerFeedbackRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1437
+
1438
+ /**
1439
+ * Send feedback on answer - feedback is logged and used to improve the answer algorithm.
1440
+ * @param trackingId - The id of the answer that you are giving feedback to.
1441
+ * @param isThumbsUp - True = Like, False = Dislike.
1442
+ * @returns This method has no return value
1443
+ */
1444
+ public async answerFeedbackAsync(trackingId: string, isThumbsUp: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1445
+
1446
+ public async answerFeedbackAsync(trackingId:string|carriers.AI_AnswerFeedbackRequest, isThumbsUp?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1447
+ let _request : carriers.AI_AnswerFeedbackRequest = null;
1448
+ let _options : base.WebApiRequestOptions = null;
1449
+ const first : any = trackingId;
1450
+ if( typeof( first ) === "object" && first && ( typeof(first.trackingId)!='undefined' || typeof(first.isThumbsUp)!='undefined' ) )
1451
+ {
1452
+ _request = trackingId as carriers.AI_AnswerFeedbackRequest;
1453
+ _options = isThumbsUp as base.WebApiRequestOptions;
1454
+ }
1455
+ else
1456
+ {
1457
+ _request = {
1458
+ trackingId: trackingId as string,
1459
+ isThumbsUp: isThumbsUp as boolean,
1460
+ };
1461
+ _options = webapi_options;
1462
+ }
1463
+ return this._answerFeedbackAsync( _request, _options );
1464
+ }
1465
+
1466
+
1467
+ private async _answerAcceptedAsync(request: carriers.AI_AnswerAcceptedRequest, options?:base.WebApiRequestOptions) : Promise< void > {
1468
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1469
+ base.WebApiBase.SetPending(options);
1470
+ return new Promise< void >(async (resolve, reject) => {
1471
+ try {
1472
+ config.baseURL = this._options.baseUrl;
1473
+ const response = await this._axios.post("AnswerAccepted", request , config);
1474
+ base.WebApiBase.SetCompleted(options, response);
1475
+ const res = response.data;
1476
+ resolve(res);
1477
+ }
1478
+ catch( err ) {
1479
+ base.WebApiBase.HandleError(options, config, err);
1480
+ reject(err);
1481
+ }
1482
+ });
1483
+ }
1484
+
1485
+
1486
+
1487
+ /**
1488
+ * Signal that answer was inserted into response- feedback is logged and used to improve the answer algorithm.
1489
+ * @param request - TrackingId
1490
+ * @returns This method has no return value
1491
+ */
1492
+ public async answerAcceptedAsync(request: carriers.AI_AnswerAcceptedRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1493
+
1494
+ /**
1495
+ * Signal that answer was inserted into response- feedback is logged and used to improve the answer algorithm.
1496
+ * @param trackingId - The id of the answer that you are giving feedback to.
1497
+ * @returns This method has no return value
1498
+ */
1499
+ public async answerAcceptedAsync(trackingId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
1500
+
1501
+ public async answerAcceptedAsync(trackingId:string|carriers.AI_AnswerAcceptedRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
1502
+ let _request : carriers.AI_AnswerAcceptedRequest = null;
1503
+ let _options : base.WebApiRequestOptions = null;
1504
+ const first : any = trackingId;
1505
+ if( typeof( first ) === "object" && first && ( typeof(first.trackingId)!='undefined' ) )
1506
+ {
1507
+ _request = trackingId as carriers.AI_AnswerAcceptedRequest;
1508
+ _options = webapi_options as base.WebApiRequestOptions;
1509
+ }
1510
+ else
1511
+ {
1512
+ _request = {
1513
+ trackingId: trackingId as string,
1514
+ };
1515
+ _options = webapi_options;
1516
+ }
1517
+ return this._answerAcceptedAsync( _request, _options );
1518
+ }
1519
+
1520
+
1521
+ private async _searchAsync(request: carriers.AI_SearchRequest, options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] > {
1522
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1523
+ base.WebApiBase.SetPending(options);
1524
+ return new Promise< carriers.RagResult[] >(async (resolve, reject) => {
1525
+ try {
1526
+ config.baseURL = this._options.baseUrl;
1527
+ const response = await this._axios.post("Search", request , config);
1528
+ base.WebApiBase.SetCompleted(options, response);
1529
+ const res : carriers.RagResult[] = converters.Create_RagResultArray_From( response.data );
1530
+ resolve(res);
1531
+ }
1532
+ catch( err ) {
1533
+ base.WebApiBase.HandleError(options, config, err);
1534
+ reject(err);
1535
+ }
1536
+ });
1537
+ }
1538
+
1539
+
1540
+
1541
+ /**
1542
+ * Returns semantic search results from vector database.
1543
+ * @param request - NamespaceName, Query, Type, Top
1544
+ * @returns Array containing vector search results
1545
+ */
1546
+ public async searchAsync(request: carriers.AI_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
1547
+
1548
+ /**
1549
+ * Returns semantic search results from vector database.
1550
+ * @param namespaceName - Defines the search domain. e.g. 'ServiceCopilot'.
1551
+ * @param query - Search query.
1552
+ * @param type - Filter results based on a specific content type. Default: None = no filtering
1553
+ * @param top - Max Number of results to return.
1554
+ * @returns Array containing vector search results
1555
+ */
1556
+ public async searchAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
1557
+
1558
+ public async searchAsync(namespaceName:string|carriers.AI_SearchRequest, query?:string|base.WebApiRequestOptions, type?:enums.RagType, top?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] > {
1559
+ let _request : carriers.AI_SearchRequest = null;
1560
+ let _options : base.WebApiRequestOptions = null;
1561
+ const first : any = namespaceName;
1562
+ if( typeof( first ) === "object" && first && ( typeof(first.namespaceName)!='undefined' || typeof(first.query)!='undefined' || typeof(first.type)!='undefined' || typeof(first.top)!='undefined' ) )
1563
+ {
1564
+ _request = namespaceName as carriers.AI_SearchRequest;
1565
+ _options = query as base.WebApiRequestOptions;
1566
+ }
1567
+ else
1568
+ {
1569
+ _request = {
1570
+ namespaceName: namespaceName as string,
1571
+ query: query as string,
1572
+ type: type as enums.RagType,
1573
+ top: top as number,
1574
+ };
1575
+ _options = webapi_options;
1576
+ }
1577
+ return this._searchAsync( _request, _options );
1578
+ }
1579
+
1580
+
1581
+ private async _startRagIndexingAsync(request: carriers.AI_StartRagIndexingRequest, options?:base.WebApiRequestOptions) : Promise< number > {
1582
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1583
+ base.WebApiBase.SetPending(options);
1584
+ return new Promise< number >(async (resolve, reject) => {
1585
+ try {
1586
+ config.baseURL = this._options.baseUrl;
1587
+ const response = await this._axios.post("StartRagIndexing", request , config);
1588
+ base.WebApiBase.SetCompleted(options, response);
1589
+ const res : number = response.data as number;
1590
+ resolve(res);
1591
+ }
1592
+ catch( err ) {
1593
+ base.WebApiBase.HandleError(options, config, err);
1594
+ reject(err);
1595
+ }
1596
+ });
1597
+ }
1598
+
1599
+
1600
+
1601
+ /**
1602
+ * Kicks off a batch task to update the RAG index
1603
+ * @param request - NamespaceName, SourceId
1604
+ * @returns The batch task id
1605
+ */
1606
+ public async startRagIndexingAsync(request: carriers.AI_StartRagIndexingRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1607
+
1608
+ /**
1609
+ * Kicks off a batch task to update the RAG index
1610
+ * @param namespaceName - Defines the search domain. e.g. 'ServiceCopilot'.
1611
+ * @param sourceId - (Optional) Identifies the data source to update. Blank = all sources
1612
+ * @returns The batch task id
1613
+ */
1614
+ public async startRagIndexingAsync(namespaceName: string, sourceId: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
1615
+
1616
+ public async startRagIndexingAsync(namespaceName:string|carriers.AI_StartRagIndexingRequest, sourceId?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
1617
+ let _request : carriers.AI_StartRagIndexingRequest = null;
1618
+ let _options : base.WebApiRequestOptions = null;
1619
+ const first : any = namespaceName;
1620
+ if( typeof( first ) === "object" && first && ( typeof(first.namespaceName)!='undefined' || typeof(first.sourceId)!='undefined' ) )
1621
+ {
1622
+ _request = namespaceName as carriers.AI_StartRagIndexingRequest;
1623
+ _options = sourceId as base.WebApiRequestOptions;
1624
+ }
1625
+ else
1626
+ {
1627
+ _request = {
1628
+ namespaceName: namespaceName as string,
1629
+ sourceId: sourceId as string,
1630
+ };
1631
+ _options = webapi_options;
1632
+ }
1633
+ return this._startRagIndexingAsync( _request, _options );
1634
+ }
1635
+
1636
+
1637
+ private async _summarizeTicketAsync(request: carriers.AI_SummarizeTicketRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1638
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1639
+ base.WebApiBase.SetPending(options);
1640
+ return new Promise< string >(async (resolve, reject) => {
1641
+ try {
1642
+ config.baseURL = this._options.baseUrl;
1643
+ const response = await this._axios.post("SummarizeTicket", request , config);
1644
+ base.WebApiBase.SetCompleted(options, response);
1645
+ const res : string = response.data as string;
1646
+ resolve(res);
1647
+ }
1648
+ catch( err ) {
1649
+ base.WebApiBase.HandleError(options, config, err);
1650
+ reject(err);
1651
+ }
1652
+ });
1653
+ }
1654
+
1655
+
1656
+
1657
+ /**
1658
+ * Generate a short summary of the messages on a ticket
1659
+ * @param request - TicketId, NumSentences, IsoLangCode
1660
+ * @returns Short summary of the messages on a ticket - in HTML.
1661
+ */
1662
+ public async summarizeTicketAsync(request: carriers.AI_SummarizeTicketRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1663
+
1664
+ /**
1665
+ * Generate a short summary of the messages on a ticket
1666
+ * @param ticketId - Ticket id to summarize
1667
+ * @param numSentences - Length of summary
1668
+ * @param isoLangCode - Language returned text should be in
1669
+ * @returns Short summary of the messages on a ticket - in HTML.
1670
+ */
1671
+ public async summarizeTicketAsync(ticketId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1672
+
1673
+ public async summarizeTicketAsync(ticketId:number|carriers.AI_SummarizeTicketRequest, numSentences?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1674
+ let _request : carriers.AI_SummarizeTicketRequest = null;
1675
+ let _options : base.WebApiRequestOptions = null;
1676
+ const first : any = ticketId;
1677
+ if( typeof( first ) === "object" && first && ( typeof(first.ticketId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1678
+ {
1679
+ _request = ticketId as carriers.AI_SummarizeTicketRequest;
1680
+ _options = numSentences as base.WebApiRequestOptions;
1681
+ }
1682
+ else
1683
+ {
1684
+ _request = {
1685
+ ticketId: ticketId as number,
1686
+ numSentences: numSentences as number,
1687
+ isoLangCode: isoLangCode as string,
1688
+ };
1689
+ _options = webapi_options;
1690
+ }
1691
+ return this._summarizeTicketAsync( _request, _options );
1692
+ }
1693
+
1694
+
1695
+ private async _getSummarizeTicketPromptAsync(request: carriers.AI_GetSummarizeTicketPromptRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1696
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1697
+ base.WebApiBase.SetPending(options);
1698
+ return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
1699
+ try {
1700
+ config.baseURL = this._options.baseUrl;
1701
+ const response = await this._axios.post("GetSummarizeTicketPrompt", request , config);
1702
+ base.WebApiBase.SetCompleted(options, response);
1703
+ const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
1704
+ resolve(res);
1705
+ }
1706
+ catch( err ) {
1707
+ base.WebApiBase.HandleError(options, config, err);
1708
+ reject(err);
1709
+ }
1710
+ });
1711
+ }
1712
+
1713
+
1714
+
1715
+ /**
1716
+ * Return the prompt used to get a short summary of the messages on a ticket. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1717
+ * @param request - TicketId, NumSentences, Summary, IsoLangCode
1718
+ * @returns Display text and Prompt used to generate a short summary of the messages on a ticket.
1719
+ */
1720
+ public async getSummarizeTicketPromptAsync(request: carriers.AI_GetSummarizeTicketPromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1721
+
1722
+ /**
1723
+ * Return the prompt used to get a short summary of the messages on a ticket. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1724
+ * @param ticketId - Ticket id to summarize
1725
+ * @param numSentences - Length of summary
1726
+ * @param summary - Chatbot's summary of the ticket
1727
+ * @param isoLangCode - Language returned text should be in
1728
+ * @returns Display text and Prompt used to generate a short summary of the messages on a ticket.
1729
+ */
1730
+ public async getSummarizeTicketPromptAsync(ticketId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1731
+
1732
+ public async getSummarizeTicketPromptAsync(ticketId:number|carriers.AI_GetSummarizeTicketPromptRequest, numSentences?:number|base.WebApiRequestOptions, summary?:string, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1733
+ let _request : carriers.AI_GetSummarizeTicketPromptRequest = null;
1734
+ let _options : base.WebApiRequestOptions = null;
1735
+ const first : any = ticketId;
1736
+ if( typeof( first ) === "object" && first && ( typeof(first.ticketId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.summary)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1737
+ {
1738
+ _request = ticketId as carriers.AI_GetSummarizeTicketPromptRequest;
1739
+ _options = numSentences as base.WebApiRequestOptions;
1740
+ }
1741
+ else
1742
+ {
1743
+ _request = {
1744
+ ticketId: ticketId as number,
1745
+ numSentences: numSentences as number,
1746
+ summary: summary as string,
1747
+ isoLangCode: isoLangCode as string,
1748
+ };
1749
+ _options = webapi_options;
1750
+ }
1751
+ return this._getSummarizeTicketPromptAsync( _request, _options );
1752
+ }
1753
+
1754
+
1755
+ private async _summarizeContactAsync(request: carriers.AI_SummarizeContactRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1756
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1757
+ base.WebApiBase.SetPending(options);
1758
+ return new Promise< string >(async (resolve, reject) => {
1759
+ try {
1760
+ config.baseURL = this._options.baseUrl;
1761
+ const response = await this._axios.post("SummarizeContact", request , config);
1762
+ base.WebApiBase.SetCompleted(options, response);
1763
+ const res : string = response.data as string;
1764
+ resolve(res);
1765
+ }
1766
+ catch( err ) {
1767
+ base.WebApiBase.HandleError(options, config, err);
1768
+ reject(err);
1769
+ }
1770
+ });
1771
+ }
1772
+
1773
+
1774
+
1775
+ /**
1776
+ * Generate a short summary of the activities on a contact
1777
+ * @param request - ContactId, NumSentences, IsoLangCode
1778
+ * @returns Short summary of the activities on a contact - in HTML.
1779
+ */
1780
+ public async summarizeContactAsync(request: carriers.AI_SummarizeContactRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1781
+
1782
+ /**
1783
+ * Generate a short summary of the activities on a contact
1784
+ * @param contactId - Contact id to summarize
1785
+ * @param numSentences - Length of summary
1786
+ * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
1787
+ * @returns Short summary of the activities on a contact - in HTML.
1788
+ */
1789
+ public async summarizeContactAsync(contactId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1790
+
1791
+ public async summarizeContactAsync(contactId:number|carriers.AI_SummarizeContactRequest, numSentences?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1792
+ let _request : carriers.AI_SummarizeContactRequest = null;
1793
+ let _options : base.WebApiRequestOptions = null;
1794
+ const first : any = contactId;
1795
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1796
+ {
1797
+ _request = contactId as carriers.AI_SummarizeContactRequest;
1798
+ _options = numSentences as base.WebApiRequestOptions;
1799
+ }
1800
+ else
1801
+ {
1802
+ _request = {
1803
+ contactId: contactId as number,
1804
+ numSentences: numSentences as number,
1805
+ isoLangCode: isoLangCode as string,
1806
+ };
1807
+ _options = webapi_options;
1808
+ }
1809
+ return this._summarizeContactAsync( _request, _options );
1810
+ }
1811
+
1812
+
1813
+ private async _getSummarizeContactPromptAsync(request: carriers.AI_GetSummarizeContactPromptRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1814
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1815
+ base.WebApiBase.SetPending(options);
1816
+ return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
1817
+ try {
1818
+ config.baseURL = this._options.baseUrl;
1819
+ const response = await this._axios.post("GetSummarizeContactPrompt", request , config);
1820
+ base.WebApiBase.SetCompleted(options, response);
1821
+ const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
1822
+ resolve(res);
1823
+ }
1824
+ catch( err ) {
1825
+ base.WebApiBase.HandleError(options, config, err);
1826
+ reject(err);
1827
+ }
1828
+ });
1829
+ }
1830
+
1831
+
1832
+
1833
+ /**
1834
+ * Return the prompt used to get a short summary of the activities on a contact. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1835
+ * @param request - ContactId, NumSentences, Summary, IsoLangCode
1836
+ * @returns Display text and Prompt used to generate a short summary of the activities on a contact.
1837
+ */
1838
+ public async getSummarizeContactPromptAsync(request: carriers.AI_GetSummarizeContactPromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1839
+
1840
+ /**
1841
+ * Return the prompt used to get a short summary of the activities on a contact. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1842
+ * @param contactId - Contact id to summarize
1843
+ * @param numSentences - Length of summary
1844
+ * @param summary - Chatbot's summary of the contact activities
1845
+ * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
1846
+ * @returns Display text and Prompt used to generate a short summary of the activities on a contact.
1847
+ */
1848
+ public async getSummarizeContactPromptAsync(contactId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1849
+
1850
+ public async getSummarizeContactPromptAsync(contactId:number|carriers.AI_GetSummarizeContactPromptRequest, numSentences?:number|base.WebApiRequestOptions, summary?:string, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1851
+ let _request : carriers.AI_GetSummarizeContactPromptRequest = null;
1852
+ let _options : base.WebApiRequestOptions = null;
1853
+ const first : any = contactId;
1854
+ if( typeof( first ) === "object" && first && ( typeof(first.contactId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.summary)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1855
+ {
1856
+ _request = contactId as carriers.AI_GetSummarizeContactPromptRequest;
1857
+ _options = numSentences as base.WebApiRequestOptions;
1858
+ }
1859
+ else
1860
+ {
1861
+ _request = {
1862
+ contactId: contactId as number,
1863
+ numSentences: numSentences as number,
1864
+ summary: summary as string,
1865
+ isoLangCode: isoLangCode as string,
1866
+ };
1867
+ _options = webapi_options;
1868
+ }
1869
+ return this._getSummarizeContactPromptAsync( _request, _options );
1870
+ }
1871
+
1872
+
1873
+ private async _summarizeSaleAsync(request: carriers.AI_SummarizeSaleRequest, options?:base.WebApiRequestOptions) : Promise< string > {
1874
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1875
+ base.WebApiBase.SetPending(options);
1876
+ return new Promise< string >(async (resolve, reject) => {
1877
+ try {
1878
+ config.baseURL = this._options.baseUrl;
1879
+ const response = await this._axios.post("SummarizeSale", request , config);
1880
+ base.WebApiBase.SetCompleted(options, response);
1881
+ const res : string = response.data as string;
1882
+ resolve(res);
1883
+ }
1884
+ catch( err ) {
1885
+ base.WebApiBase.HandleError(options, config, err);
1886
+ reject(err);
1887
+ }
1888
+ });
1889
+ }
1890
+
1891
+
1892
+
1893
+ /**
1894
+ * Generate a short summary of the activities on a sale
1895
+ * @param request - SaleId, NumSentences, IsoLangCode
1896
+ * @returns Short summary of the activities on a sale - in HTML.
1897
+ */
1898
+ public async summarizeSaleAsync(request: carriers.AI_SummarizeSaleRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1899
+
1900
+ /**
1901
+ * Generate a short summary of the activities on a sale
1902
+ * @param saleId - Sale id to summarize
1903
+ * @param numSentences - Length of summary
1904
+ * @param isoLangCode - Language returned text should be in. Blank = do not specify language.
1905
+ * @returns Short summary of the activities on a sale - in HTML.
1906
+ */
1907
+ public async summarizeSaleAsync(saleId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
1908
+
1909
+ public async summarizeSaleAsync(saleId:number|carriers.AI_SummarizeSaleRequest, numSentences?:number|base.WebApiRequestOptions, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< string > {
1910
+ let _request : carriers.AI_SummarizeSaleRequest = null;
1911
+ let _options : base.WebApiRequestOptions = null;
1912
+ const first : any = saleId;
1913
+ if( typeof( first ) === "object" && first && ( typeof(first.saleId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1914
+ {
1915
+ _request = saleId as carriers.AI_SummarizeSaleRequest;
1916
+ _options = numSentences as base.WebApiRequestOptions;
1917
+ }
1918
+ else
1919
+ {
1920
+ _request = {
1921
+ saleId: saleId as number,
1922
+ numSentences: numSentences as number,
1923
+ isoLangCode: isoLangCode as string,
1924
+ };
1925
+ _options = webapi_options;
1926
+ }
1927
+ return this._summarizeSaleAsync( _request, _options );
1928
+ }
1929
+
1930
+
1931
+ private async _getSummarizeSalePromptAsync(request: carriers.AI_GetSummarizeSalePromptRequest, options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1932
+ const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
1933
+ base.WebApiBase.SetPending(options);
1934
+ return new Promise< carriers.ChatbotTurn >(async (resolve, reject) => {
1935
+ try {
1936
+ config.baseURL = this._options.baseUrl;
1937
+ const response = await this._axios.post("GetSummarizeSalePrompt", request , config);
1938
+ base.WebApiBase.SetCompleted(options, response);
1939
+ const res : carriers.ChatbotTurn = converters.Create_ChatbotTurn_From( response.data );
1940
+ resolve(res);
1941
+ }
1942
+ catch( err ) {
1943
+ base.WebApiBase.HandleError(options, config, err);
1944
+ reject(err);
1945
+ }
1946
+ });
1947
+ }
1948
+
1949
+
1950
+
1951
+ /**
1952
+ * Return the prompt used to get a short summary of the activities on a sale. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1953
+ * @param request - SaleId, NumSentences, Summary, IsoLangCode
1954
+ * @returns Display text and Prompt used to generate a short summary of the activities on a sale.
1955
+ */
1956
+ public async getSummarizeSalePromptAsync(request: carriers.AI_GetSummarizeSalePromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1957
+
1958
+ /**
1959
+ * Return the prompt used to get a short summary of the activities on a sale. Does not call the chatbot for a response. Used for transfering a summary to a chat session.
1960
+ * @param saleId - Sale id to summarize
1961
+ * @param numSentences - Length of summary
1962
+ * @param summary - Chatbot's summary of the sale activities
1963
+ * @param isoLangCode - Language returned text should be in
1964
+ * @returns Display text and Prompt used to generate a short summary of the activities on a sale.
1965
+ */
1966
+ public async getSummarizeSalePromptAsync(saleId: number, numSentences: number, summary: string, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
1967
+
1968
+ public async getSummarizeSalePromptAsync(saleId:number|carriers.AI_GetSummarizeSalePromptRequest, numSentences?:number|base.WebApiRequestOptions, summary?:string, isoLangCode?:string, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn > {
1969
+ let _request : carriers.AI_GetSummarizeSalePromptRequest = null;
1970
+ let _options : base.WebApiRequestOptions = null;
1971
+ const first : any = saleId;
1972
+ if( typeof( first ) === "object" && first && ( typeof(first.saleId)!='undefined' || typeof(first.numSentences)!='undefined' || typeof(first.summary)!='undefined' || typeof(first.isoLangCode)!='undefined' ) )
1973
+ {
1974
+ _request = saleId as carriers.AI_GetSummarizeSalePromptRequest;
1975
+ _options = numSentences as base.WebApiRequestOptions;
1976
+ }
1977
+ else
1978
+ {
1979
+ _request = {
1980
+ saleId: saleId as number,
1981
+ numSentences: numSentences as number,
1982
+ summary: summary as string,
1983
+ isoLangCode: isoLangCode as string,
1984
+ };
1985
+ _options = webapi_options;
1986
+ }
1987
+ return this._getSummarizeSalePromptAsync( _request, _options );
1988
+ }
1989
+
1990
+ } // class v1AIAgentController
1991
+
1992
+