@servicetitan/titan-chatbot-api 3.0.0

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 (160) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/api-client/__mocks__/chatbot-api-client.mock.d.ts +11 -0
  3. package/dist/api-client/__mocks__/chatbot-api-client.mock.d.ts.map +1 -0
  4. package/dist/api-client/__mocks__/chatbot-api-client.mock.js +47 -0
  5. package/dist/api-client/__mocks__/chatbot-api-client.mock.js.map +1 -0
  6. package/dist/api-client/base/chatbot-api-client.d.ts +27 -0
  7. package/dist/api-client/base/chatbot-api-client.d.ts.map +1 -0
  8. package/dist/api-client/base/chatbot-api-client.js +10 -0
  9. package/dist/api-client/base/chatbot-api-client.js.map +1 -0
  10. package/dist/api-client/help-center/__tests__/converter-from-models.test.d.ts +2 -0
  11. package/dist/api-client/help-center/__tests__/converter-from-models.test.d.ts.map +1 -0
  12. package/dist/api-client/help-center/__tests__/converter-from-models.test.js +34 -0
  13. package/dist/api-client/help-center/__tests__/converter-from-models.test.js.map +1 -0
  14. package/dist/api-client/help-center/__tests__/converter-to-models.test.d.ts +2 -0
  15. package/dist/api-client/help-center/__tests__/converter-to-models.test.d.ts.map +1 -0
  16. package/dist/api-client/help-center/__tests__/converter-to-models.test.js +82 -0
  17. package/dist/api-client/help-center/__tests__/converter-to-models.test.js.map +1 -0
  18. package/dist/api-client/help-center/chatbot-api-client.d.ts +31 -0
  19. package/dist/api-client/help-center/chatbot-api-client.d.ts.map +1 -0
  20. package/dist/api-client/help-center/chatbot-api-client.js +90 -0
  21. package/dist/api-client/help-center/chatbot-api-client.js.map +1 -0
  22. package/dist/api-client/help-center/converter-from-models.d.ts +13 -0
  23. package/dist/api-client/help-center/converter-from-models.d.ts.map +1 -0
  24. package/dist/api-client/help-center/converter-from-models.js +113 -0
  25. package/dist/api-client/help-center/converter-from-models.js.map +1 -0
  26. package/dist/api-client/help-center/converter-to-models.d.ts +13 -0
  27. package/dist/api-client/help-center/converter-to-models.d.ts.map +1 -0
  28. package/dist/api-client/help-center/converter-to-models.js +95 -0
  29. package/dist/api-client/help-center/converter-to-models.js.map +1 -0
  30. package/dist/api-client/help-center/index.d.ts +2 -0
  31. package/dist/api-client/help-center/index.d.ts.map +1 -0
  32. package/dist/api-client/help-center/index.js +2 -0
  33. package/dist/api-client/help-center/index.js.map +1 -0
  34. package/dist/api-client/help-center/native-client.d.ts +1260 -0
  35. package/dist/api-client/help-center/native-client.d.ts.map +1 -0
  36. package/dist/api-client/help-center/native-client.js +6169 -0
  37. package/dist/api-client/help-center/native-client.js.map +1 -0
  38. package/dist/api-client/index.d.ts +8 -0
  39. package/dist/api-client/index.d.ts.map +1 -0
  40. package/dist/api-client/index.js +8 -0
  41. package/dist/api-client/index.js.map +1 -0
  42. package/dist/api-client/models/__mocks__/models.mock.d.ts +13 -0
  43. package/dist/api-client/models/__mocks__/models.mock.d.ts.map +1 -0
  44. package/dist/api-client/models/__mocks__/models.mock.js +114 -0
  45. package/dist/api-client/models/__mocks__/models.mock.js.map +1 -0
  46. package/dist/api-client/models/index.d.ts +22 -0
  47. package/dist/api-client/models/index.d.ts.map +1 -0
  48. package/dist/api-client/models/index.js +15 -0
  49. package/dist/api-client/models/index.js.map +1 -0
  50. package/dist/api-client/titan-chat/chatbot-api-client.d.ts +34 -0
  51. package/dist/api-client/titan-chat/chatbot-api-client.d.ts.map +1 -0
  52. package/dist/api-client/titan-chat/chatbot-api-client.js +72 -0
  53. package/dist/api-client/titan-chat/chatbot-api-client.js.map +1 -0
  54. package/dist/api-client/titan-chat/index.d.ts +2 -0
  55. package/dist/api-client/titan-chat/index.d.ts.map +1 -0
  56. package/dist/api-client/titan-chat/index.js +2 -0
  57. package/dist/api-client/titan-chat/index.js.map +1 -0
  58. package/dist/api-client/titan-chat/native-client.d.ts +225 -0
  59. package/dist/api-client/titan-chat/native-client.d.ts.map +1 -0
  60. package/dist/api-client/titan-chat/native-client.js +931 -0
  61. package/dist/api-client/titan-chat/native-client.js.map +1 -0
  62. package/dist/api-client/utils/model-utils.d.ts +4 -0
  63. package/dist/api-client/utils/model-utils.d.ts.map +1 -0
  64. package/dist/api-client/utils/model-utils.js +58 -0
  65. package/dist/api-client/utils/model-utils.js.map +1 -0
  66. package/dist/index.d.ts +6 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +7 -0
  69. package/dist/index.js.map +1 -0
  70. package/dist/models/chatbot-customizations.d.ts +15 -0
  71. package/dist/models/chatbot-customizations.d.ts.map +1 -0
  72. package/dist/models/chatbot-customizations.js +2 -0
  73. package/dist/models/chatbot-customizations.js.map +1 -0
  74. package/dist/models/index.d.ts +2 -0
  75. package/dist/models/index.d.ts.map +1 -0
  76. package/dist/models/index.js +2 -0
  77. package/dist/models/index.js.map +1 -0
  78. package/dist/stores/__tests__/chatbot-ui-backend.store.test.d.ts +2 -0
  79. package/dist/stores/__tests__/chatbot-ui-backend.store.test.d.ts.map +1 -0
  80. package/dist/stores/__tests__/chatbot-ui-backend.store.test.js +341 -0
  81. package/dist/stores/__tests__/chatbot-ui-backend.store.test.js.map +1 -0
  82. package/dist/stores/__tests__/chatbot-ui.store.test.d.ts +2 -0
  83. package/dist/stores/__tests__/chatbot-ui.store.test.d.ts.map +1 -0
  84. package/dist/stores/__tests__/chatbot-ui.store.test.js +166 -0
  85. package/dist/stores/__tests__/chatbot-ui.store.test.js.map +1 -0
  86. package/dist/stores/__tests__/filter.store.test.d.ts +2 -0
  87. package/dist/stores/__tests__/filter.store.test.d.ts.map +1 -0
  88. package/dist/stores/__tests__/filter.store.test.js +316 -0
  89. package/dist/stores/__tests__/filter.store.test.js.map +1 -0
  90. package/dist/stores/__tests__/initialize.store.test.d.ts +2 -0
  91. package/dist/stores/__tests__/initialize.store.test.d.ts.map +1 -0
  92. package/dist/stores/__tests__/initialize.store.test.js +54 -0
  93. package/dist/stores/__tests__/initialize.store.test.js.map +1 -0
  94. package/dist/stores/chatbot-ui-backend.store.d.ts +61 -0
  95. package/dist/stores/chatbot-ui-backend.store.d.ts.map +1 -0
  96. package/dist/stores/chatbot-ui-backend.store.js +396 -0
  97. package/dist/stores/chatbot-ui-backend.store.js.map +1 -0
  98. package/dist/stores/chatbot-ui.store.d.ts +25 -0
  99. package/dist/stores/chatbot-ui.store.d.ts.map +1 -0
  100. package/dist/stores/chatbot-ui.store.js +87 -0
  101. package/dist/stores/chatbot-ui.store.js.map +1 -0
  102. package/dist/stores/filter.store.d.ts +30 -0
  103. package/dist/stores/filter.store.d.ts.map +1 -0
  104. package/dist/stores/filter.store.js +334 -0
  105. package/dist/stores/filter.store.js.map +1 -0
  106. package/dist/stores/index.d.ts +4 -0
  107. package/dist/stores/index.d.ts.map +1 -0
  108. package/dist/stores/index.js +4 -0
  109. package/dist/stores/index.js.map +1 -0
  110. package/dist/stores/initialize.store.d.ts +17 -0
  111. package/dist/stores/initialize.store.d.ts.map +1 -0
  112. package/dist/stores/initialize.store.js +98 -0
  113. package/dist/stores/initialize.store.js.map +1 -0
  114. package/dist/utils/__tests__/axios-utils.test.d.ts +2 -0
  115. package/dist/utils/__tests__/axios-utils.test.d.ts.map +1 -0
  116. package/dist/utils/__tests__/axios-utils.test.js +33 -0
  117. package/dist/utils/__tests__/axios-utils.test.js.map +1 -0
  118. package/dist/utils/axios-utils.d.ts +5 -0
  119. package/dist/utils/axios-utils.d.ts.map +1 -0
  120. package/dist/utils/axios-utils.js +23 -0
  121. package/dist/utils/axios-utils.js.map +1 -0
  122. package/dist/utils/test-utils.d.ts +5 -0
  123. package/dist/utils/test-utils.d.ts.map +1 -0
  124. package/dist/utils/test-utils.js +17 -0
  125. package/dist/utils/test-utils.js.map +1 -0
  126. package/package.json +45 -0
  127. package/src/api-client/__mocks__/chatbot-api-client.mock.ts +11 -0
  128. package/src/api-client/base/chatbot-api-client.ts +33 -0
  129. package/src/api-client/help-center/__tests__/converter-from-models.test.ts +41 -0
  130. package/src/api-client/help-center/__tests__/converter-to-models.test.ts +89 -0
  131. package/src/api-client/help-center/chatbot-api-client.ts +107 -0
  132. package/src/api-client/help-center/converter-from-models.ts +132 -0
  133. package/src/api-client/help-center/converter-to-models.ts +124 -0
  134. package/src/api-client/help-center/index.ts +1 -0
  135. package/src/api-client/help-center/native-client.ts +5662 -0
  136. package/src/api-client/index.ts +12 -0
  137. package/src/api-client/models/__mocks__/models.mock.ts +141 -0
  138. package/src/api-client/models/index.ts +48 -0
  139. package/src/api-client/titan-chat/chatbot-api-client.ts +77 -0
  140. package/src/api-client/titan-chat/index.ts +1 -0
  141. package/src/api-client/titan-chat/native-client.ts +826 -0
  142. package/src/api-client/utils/model-utils.ts +68 -0
  143. package/src/cypress.d.ts +10 -0
  144. package/src/index.ts +6 -0
  145. package/src/models/chatbot-customizations.ts +16 -0
  146. package/src/models/index.ts +1 -0
  147. package/src/stores/__tests__/chatbot-ui-backend.store.test.ts +426 -0
  148. package/src/stores/__tests__/chatbot-ui.store.test.ts +196 -0
  149. package/src/stores/__tests__/filter.store.test.ts +363 -0
  150. package/src/stores/__tests__/initialize.store.test.ts +73 -0
  151. package/src/stores/chatbot-ui-backend.store.ts +401 -0
  152. package/src/stores/chatbot-ui.store.ts +82 -0
  153. package/src/stores/filter.store.ts +250 -0
  154. package/src/stores/index.ts +12 -0
  155. package/src/stores/initialize.store.ts +62 -0
  156. package/src/utils/__tests__/axios-utils.test.ts +40 -0
  157. package/src/utils/axios-utils.ts +25 -0
  158. package/src/utils/test-utils.ts +22 -0
  159. package/tsconfig.json +19 -0
  160. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,931 @@
1
+ //----------------------
2
+ // <auto-generated>
3
+ // Generated using the NSwag toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
4
+ // </auto-generated>
5
+ //----------------------
6
+ /* tslint:disable */
7
+ /* eslint-disable */
8
+ // ReSharper disable InconsistentNaming
9
+ export class Client {
10
+ constructor(baseUrl, http) {
11
+ Object.defineProperty(this, "http", {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value: void 0
16
+ });
17
+ Object.defineProperty(this, "baseUrl", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: void 0
22
+ });
23
+ Object.defineProperty(this, "jsonParseReviver", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: undefined
28
+ });
29
+ this.http = http ? http : window;
30
+ this.baseUrl = baseUrl !== null && baseUrl !== void 0 ? baseUrl : "";
31
+ }
32
+ /**
33
+ * @param x_Client_ID (optional)
34
+ * @param body (optional)
35
+ * @return Success
36
+ */
37
+ feedback(version, x_Client_ID, body, signal) {
38
+ let url_ = this.baseUrl + "/api/v{version}/feedback";
39
+ if (version === undefined || version === null)
40
+ throw new Error("The parameter 'version' must be defined.");
41
+ url_ = url_.replace("{version}", encodeURIComponent("" + version));
42
+ url_ = url_.replace(/[?&]$/, "");
43
+ const content_ = JSON.stringify(body);
44
+ let options_ = {
45
+ body: content_,
46
+ method: "POST",
47
+ signal,
48
+ headers: {
49
+ "X-Client-ID": x_Client_ID !== undefined && x_Client_ID !== null ? "" + x_Client_ID : "",
50
+ "Content-Type": "application/json",
51
+ "Accept": "text/plain"
52
+ }
53
+ };
54
+ return this.http.fetch(url_, options_).then((_response) => {
55
+ return this.processFeedback(_response);
56
+ });
57
+ }
58
+ processFeedback(response) {
59
+ const status = response.status;
60
+ let _headers = {};
61
+ if (response.headers && response.headers.forEach) {
62
+ response.headers.forEach((v, k) => _headers[k] = v);
63
+ }
64
+ ;
65
+ if (status === 200) {
66
+ return response.text().then((_responseText) => {
67
+ let result200 = null;
68
+ let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
69
+ result200 = Feedback.fromJS(resultData200);
70
+ return result200;
71
+ });
72
+ }
73
+ else if (status !== 200 && status !== 204) {
74
+ return response.text().then((_responseText) => {
75
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
76
+ });
77
+ }
78
+ return Promise.resolve(null);
79
+ }
80
+ /**
81
+ * @param x_Client_ID (optional)
82
+ * @param body (optional)
83
+ * @return Success
84
+ */
85
+ message(version, x_Client_ID, body, signal) {
86
+ let url_ = this.baseUrl + "/api/v{version}/message";
87
+ if (version === undefined || version === null)
88
+ throw new Error("The parameter 'version' must be defined.");
89
+ url_ = url_.replace("{version}", encodeURIComponent("" + version));
90
+ url_ = url_.replace(/[?&]$/, "");
91
+ const content_ = JSON.stringify(body);
92
+ let options_ = {
93
+ body: content_,
94
+ method: "POST",
95
+ signal,
96
+ headers: {
97
+ "X-Client-ID": x_Client_ID !== undefined && x_Client_ID !== null ? "" + x_Client_ID : "",
98
+ "Content-Type": "application/json",
99
+ "Accept": "text/plain"
100
+ }
101
+ };
102
+ return this.http.fetch(url_, options_).then((_response) => {
103
+ return this.processMessage(_response);
104
+ });
105
+ }
106
+ processMessage(response) {
107
+ const status = response.status;
108
+ let _headers = {};
109
+ if (response.headers && response.headers.forEach) {
110
+ response.headers.forEach((v, k) => _headers[k] = v);
111
+ }
112
+ ;
113
+ if (status === 200) {
114
+ return response.text().then((_responseText) => {
115
+ let result200 = null;
116
+ let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
117
+ result200 = BotMessage.fromJS(resultData200);
118
+ return result200;
119
+ });
120
+ }
121
+ else if (status === 500) {
122
+ return response.text().then((_responseText) => {
123
+ return throwException("Server Error", status, _responseText, _headers);
124
+ });
125
+ }
126
+ else if (status === 502) {
127
+ return response.text().then((_responseText) => {
128
+ return throwException("Server Error", status, _responseText, _headers);
129
+ });
130
+ }
131
+ else if (status === 504) {
132
+ return response.text().then((_responseText) => {
133
+ return throwException("Server Error", status, _responseText, _headers);
134
+ });
135
+ }
136
+ else if (status !== 200 && status !== 204) {
137
+ return response.text().then((_responseText) => {
138
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
139
+ });
140
+ }
141
+ return Promise.resolve(null);
142
+ }
143
+ /**
144
+ * @param x_Client_ID (optional)
145
+ * @return Success
146
+ */
147
+ options(version, x_Client_ID, signal) {
148
+ let url_ = this.baseUrl + "/api/v{version}/options";
149
+ if (version === undefined || version === null)
150
+ throw new Error("The parameter 'version' must be defined.");
151
+ url_ = url_.replace("{version}", encodeURIComponent("" + version));
152
+ url_ = url_.replace(/[?&]$/, "");
153
+ let options_ = {
154
+ method: "GET",
155
+ signal,
156
+ headers: {
157
+ "X-Client-ID": x_Client_ID !== undefined && x_Client_ID !== null ? "" + x_Client_ID : "",
158
+ "Accept": "text/plain"
159
+ }
160
+ };
161
+ return this.http.fetch(url_, options_).then((_response) => {
162
+ return this.processOptions(_response);
163
+ });
164
+ }
165
+ processOptions(response) {
166
+ const status = response.status;
167
+ let _headers = {};
168
+ if (response.headers && response.headers.forEach) {
169
+ response.headers.forEach((v, k) => _headers[k] = v);
170
+ }
171
+ ;
172
+ if (status === 200) {
173
+ return response.text().then((_responseText) => {
174
+ let result200 = null;
175
+ let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
176
+ result200 = FrontendModel.fromJS(resultData200);
177
+ return result200;
178
+ });
179
+ }
180
+ else if (status !== 200 && status !== 204) {
181
+ return response.text().then((_responseText) => {
182
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
183
+ });
184
+ }
185
+ return Promise.resolve(null);
186
+ }
187
+ /**
188
+ * @param x_Client_ID (optional)
189
+ * @param body (optional)
190
+ * @return Success
191
+ */
192
+ sessionPOST(version, x_Client_ID, body, signal) {
193
+ let url_ = this.baseUrl + "/api/v{version}/session";
194
+ if (version === undefined || version === null)
195
+ throw new Error("The parameter 'version' must be defined.");
196
+ url_ = url_.replace("{version}", encodeURIComponent("" + version));
197
+ url_ = url_.replace(/[?&]$/, "");
198
+ const content_ = JSON.stringify(body);
199
+ let options_ = {
200
+ body: content_,
201
+ method: "POST",
202
+ signal,
203
+ headers: {
204
+ "X-Client-ID": x_Client_ID !== undefined && x_Client_ID !== null ? "" + x_Client_ID : "",
205
+ "Content-Type": "application/json",
206
+ "Accept": "text/plain"
207
+ }
208
+ };
209
+ return this.http.fetch(url_, options_).then((_response) => {
210
+ return this.processSessionPOST(_response);
211
+ });
212
+ }
213
+ processSessionPOST(response) {
214
+ const status = response.status;
215
+ let _headers = {};
216
+ if (response.headers && response.headers.forEach) {
217
+ response.headers.forEach((v, k) => _headers[k] = v);
218
+ }
219
+ ;
220
+ if (status === 200) {
221
+ return response.text().then((_responseText) => {
222
+ let result200 = null;
223
+ let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
224
+ result200 = Session.fromJS(resultData200);
225
+ return result200;
226
+ });
227
+ }
228
+ else if (status !== 200 && status !== 204) {
229
+ return response.text().then((_responseText) => {
230
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
231
+ });
232
+ }
233
+ return Promise.resolve(null);
234
+ }
235
+ /**
236
+ * @param x_Client_ID (optional)
237
+ * @param body (optional)
238
+ * @return Success
239
+ */
240
+ sessionPATCH(version, x_Client_ID, body, signal) {
241
+ let url_ = this.baseUrl + "/api/v{version}/session";
242
+ if (version === undefined || version === null)
243
+ throw new Error("The parameter 'version' must be defined.");
244
+ url_ = url_.replace("{version}", encodeURIComponent("" + version));
245
+ url_ = url_.replace(/[?&]$/, "");
246
+ const content_ = JSON.stringify(body);
247
+ let options_ = {
248
+ body: content_,
249
+ method: "PATCH",
250
+ signal,
251
+ headers: {
252
+ "X-Client-ID": x_Client_ID !== undefined && x_Client_ID !== null ? "" + x_Client_ID : "",
253
+ "Content-Type": "application/json",
254
+ "Accept": "text/plain"
255
+ }
256
+ };
257
+ return this.http.fetch(url_, options_).then((_response) => {
258
+ return this.processSessionPATCH(_response);
259
+ });
260
+ }
261
+ processSessionPATCH(response) {
262
+ const status = response.status;
263
+ let _headers = {};
264
+ if (response.headers && response.headers.forEach) {
265
+ response.headers.forEach((v, k) => _headers[k] = v);
266
+ }
267
+ ;
268
+ if (status === 200) {
269
+ return response.text().then((_responseText) => {
270
+ let result200 = null;
271
+ let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
272
+ result200 = Session.fromJS(resultData200);
273
+ return result200;
274
+ });
275
+ }
276
+ else if (status !== 200 && status !== 204) {
277
+ return response.text().then((_responseText) => {
278
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
279
+ });
280
+ }
281
+ return Promise.resolve(null);
282
+ }
283
+ /**
284
+ * @param x_Client_ID (optional)
285
+ * @param body (optional)
286
+ * @return Success
287
+ */
288
+ sessionDELETE(version, x_Client_ID, body, signal) {
289
+ let url_ = this.baseUrl + "/api/v{version}/session";
290
+ if (version === undefined || version === null)
291
+ throw new Error("The parameter 'version' must be defined.");
292
+ url_ = url_.replace("{version}", encodeURIComponent("" + version));
293
+ url_ = url_.replace(/[?&]$/, "");
294
+ const content_ = JSON.stringify(body);
295
+ let options_ = {
296
+ body: content_,
297
+ method: "DELETE",
298
+ signal,
299
+ headers: {
300
+ "X-Client-ID": x_Client_ID !== undefined && x_Client_ID !== null ? "" + x_Client_ID : "",
301
+ "Content-Type": "application/json",
302
+ "Accept": "text/plain"
303
+ }
304
+ };
305
+ return this.http.fetch(url_, options_).then((_response) => {
306
+ return this.processSessionDELETE(_response);
307
+ });
308
+ }
309
+ processSessionDELETE(response) {
310
+ const status = response.status;
311
+ let _headers = {};
312
+ if (response.headers && response.headers.forEach) {
313
+ response.headers.forEach((v, k) => _headers[k] = v);
314
+ }
315
+ ;
316
+ if (status === 200) {
317
+ return response.text().then((_responseText) => {
318
+ let result200 = null;
319
+ let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
320
+ result200 = Session.fromJS(resultData200);
321
+ return result200;
322
+ });
323
+ }
324
+ else if (status !== 200 && status !== 204) {
325
+ return response.text().then((_responseText) => {
326
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
327
+ });
328
+ }
329
+ return Promise.resolve(null);
330
+ }
331
+ }
332
+ export class BotMessage {
333
+ constructor(data) {
334
+ Object.defineProperty(this, "id", {
335
+ enumerable: true,
336
+ configurable: true,
337
+ writable: true,
338
+ value: void 0
339
+ });
340
+ Object.defineProperty(this, "sessionId", {
341
+ enumerable: true,
342
+ configurable: true,
343
+ writable: true,
344
+ value: void 0
345
+ });
346
+ Object.defineProperty(this, "answer", {
347
+ enumerable: true,
348
+ configurable: true,
349
+ writable: true,
350
+ value: void 0
351
+ });
352
+ Object.defineProperty(this, "scoredUrls", {
353
+ enumerable: true,
354
+ configurable: true,
355
+ writable: true,
356
+ value: void 0
357
+ });
358
+ Object.defineProperty(this, "guardFlag", {
359
+ enumerable: true,
360
+ configurable: true,
361
+ writable: true,
362
+ value: void 0
363
+ });
364
+ Object.defineProperty(this, "isGuardrailed", {
365
+ enumerable: true,
366
+ configurable: true,
367
+ writable: true,
368
+ value: void 0
369
+ });
370
+ Object.defineProperty(this, "botVersion", {
371
+ enumerable: true,
372
+ configurable: true,
373
+ writable: true,
374
+ value: void 0
375
+ });
376
+ Object.defineProperty(this, "modelVersion", {
377
+ enumerable: true,
378
+ configurable: true,
379
+ writable: true,
380
+ value: void 0
381
+ });
382
+ Object.defineProperty(this, "meta", {
383
+ enumerable: true,
384
+ configurable: true,
385
+ writable: true,
386
+ value: void 0
387
+ });
388
+ if (data) {
389
+ for (var property in data) {
390
+ if (data.hasOwnProperty(property))
391
+ this[property] = data[property];
392
+ }
393
+ }
394
+ }
395
+ init(_data) {
396
+ if (_data) {
397
+ this.id = _data["id"];
398
+ this.sessionId = _data["sessionId"];
399
+ this.answer = _data["answer"];
400
+ if (Array.isArray(_data["scoredUrls"])) {
401
+ this.scoredUrls = [];
402
+ for (let item of _data["scoredUrls"])
403
+ this.scoredUrls.push(ScoredUrl.fromJS(item));
404
+ }
405
+ this.guardFlag = _data["guardFlag"];
406
+ this.isGuardrailed = _data["isGuardrailed"];
407
+ this.botVersion = _data["botVersion"];
408
+ this.modelVersion = _data["modelVersion"];
409
+ this.meta = _data["meta"];
410
+ }
411
+ }
412
+ static fromJS(data) {
413
+ data = typeof data === 'object' ? data : {};
414
+ let result = new BotMessage();
415
+ result.init(data);
416
+ return result;
417
+ }
418
+ toJSON(data) {
419
+ data = typeof data === 'object' ? data : {};
420
+ data["id"] = this.id;
421
+ data["sessionId"] = this.sessionId;
422
+ data["answer"] = this.answer;
423
+ if (Array.isArray(this.scoredUrls)) {
424
+ data["scoredUrls"] = [];
425
+ for (let item of this.scoredUrls)
426
+ data["scoredUrls"].push(item.toJSON());
427
+ }
428
+ data["guardFlag"] = this.guardFlag;
429
+ data["isGuardrailed"] = this.isGuardrailed;
430
+ data["botVersion"] = this.botVersion;
431
+ data["modelVersion"] = this.modelVersion;
432
+ data["meta"] = this.meta;
433
+ return data;
434
+ }
435
+ }
436
+ export var Experience;
437
+ (function (Experience) {
438
+ Experience[Experience["SingleTurn"] = 1] = "SingleTurn";
439
+ Experience[Experience["MultiTurn"] = 2] = "MultiTurn";
440
+ })(Experience || (Experience = {}));
441
+ export class Feedback {
442
+ constructor(data) {
443
+ Object.defineProperty(this, "linkUrl", {
444
+ enumerable: true,
445
+ configurable: true,
446
+ writable: true,
447
+ value: void 0
448
+ });
449
+ Object.defineProperty(this, "description", {
450
+ enumerable: true,
451
+ configurable: true,
452
+ writable: true,
453
+ value: void 0
454
+ });
455
+ Object.defineProperty(this, "sessionId", {
456
+ enumerable: true,
457
+ configurable: true,
458
+ writable: true,
459
+ value: void 0
460
+ });
461
+ Object.defineProperty(this, "messageId", {
462
+ enumerable: true,
463
+ configurable: true,
464
+ writable: true,
465
+ value: void 0
466
+ });
467
+ Object.defineProperty(this, "options", {
468
+ enumerable: true,
469
+ configurable: true,
470
+ writable: true,
471
+ value: void 0
472
+ });
473
+ Object.defineProperty(this, "rating", {
474
+ enumerable: true,
475
+ configurable: true,
476
+ writable: true,
477
+ value: void 0
478
+ });
479
+ if (data) {
480
+ for (var property in data) {
481
+ if (data.hasOwnProperty(property))
482
+ this[property] = data[property];
483
+ }
484
+ }
485
+ }
486
+ init(_data) {
487
+ if (_data) {
488
+ this.linkUrl = _data["linkUrl"];
489
+ this.description = _data["description"];
490
+ this.sessionId = _data["sessionId"];
491
+ this.messageId = _data["messageId"];
492
+ if (Array.isArray(_data["options"])) {
493
+ this.options = [];
494
+ for (let item of _data["options"])
495
+ this.options.push(item);
496
+ }
497
+ this.rating = _data["rating"];
498
+ }
499
+ }
500
+ static fromJS(data) {
501
+ data = typeof data === 'object' ? data : {};
502
+ let result = new Feedback();
503
+ result.init(data);
504
+ return result;
505
+ }
506
+ toJSON(data) {
507
+ data = typeof data === 'object' ? data : {};
508
+ data["linkUrl"] = this.linkUrl;
509
+ data["description"] = this.description;
510
+ data["sessionId"] = this.sessionId;
511
+ data["messageId"] = this.messageId;
512
+ if (Array.isArray(this.options)) {
513
+ data["options"] = [];
514
+ for (let item of this.options)
515
+ data["options"].push(item);
516
+ }
517
+ data["rating"] = this.rating;
518
+ return data;
519
+ }
520
+ }
521
+ export var FeedbackOptions;
522
+ (function (FeedbackOptions) {
523
+ FeedbackOptions[FeedbackOptions["Other"] = 1] = "Other";
524
+ FeedbackOptions[FeedbackOptions["Unrelated"] = 2] = "Unrelated";
525
+ FeedbackOptions[FeedbackOptions["Unclear"] = 4] = "Unclear";
526
+ FeedbackOptions[FeedbackOptions["Incomplete"] = 8] = "Incomplete";
527
+ FeedbackOptions[FeedbackOptions["Incorrect"] = 16] = "Incorrect";
528
+ })(FeedbackOptions || (FeedbackOptions = {}));
529
+ export var FeedbackRatings;
530
+ (function (FeedbackRatings) {
531
+ FeedbackRatings[FeedbackRatings["ThumbsDown"] = 0] = "ThumbsDown";
532
+ FeedbackRatings[FeedbackRatings["ThumbsUp"] = 1] = "ThumbsUp";
533
+ FeedbackRatings[FeedbackRatings["GuardrailFeedback"] = 2] = "GuardrailFeedback";
534
+ })(FeedbackRatings || (FeedbackRatings = {}));
535
+ export class FrontendModel {
536
+ constructor(data) {
537
+ Object.defineProperty(this, "options", {
538
+ enumerable: true,
539
+ configurable: true,
540
+ writable: true,
541
+ value: void 0
542
+ });
543
+ if (data) {
544
+ for (var property in data) {
545
+ if (data.hasOwnProperty(property))
546
+ this[property] = data[property];
547
+ }
548
+ }
549
+ if (!data) {
550
+ this.options = new Option();
551
+ }
552
+ }
553
+ init(_data) {
554
+ if (_data) {
555
+ this.options = _data["options"] ? Option.fromJS(_data["options"]) : new Option();
556
+ }
557
+ }
558
+ static fromJS(data) {
559
+ data = typeof data === 'object' ? data : {};
560
+ let result = new FrontendModel();
561
+ result.init(data);
562
+ return result;
563
+ }
564
+ toJSON(data) {
565
+ data = typeof data === 'object' ? data : {};
566
+ data["options"] = this.options ? this.options.toJSON() : undefined;
567
+ return data;
568
+ }
569
+ }
570
+ export class Option {
571
+ constructor(data) {
572
+ Object.defineProperty(this, "key", {
573
+ enumerable: true,
574
+ configurable: true,
575
+ writable: true,
576
+ value: void 0
577
+ });
578
+ Object.defineProperty(this, "displayName", {
579
+ enumerable: true,
580
+ configurable: true,
581
+ writable: true,
582
+ value: void 0
583
+ });
584
+ Object.defineProperty(this, "type", {
585
+ enumerable: true,
586
+ configurable: true,
587
+ writable: true,
588
+ value: void 0
589
+ });
590
+ Object.defineProperty(this, "subOptions", {
591
+ enumerable: true,
592
+ configurable: true,
593
+ writable: true,
594
+ value: void 0
595
+ });
596
+ if (data) {
597
+ for (var property in data) {
598
+ if (data.hasOwnProperty(property))
599
+ this[property] = data[property];
600
+ }
601
+ }
602
+ }
603
+ init(_data) {
604
+ if (_data) {
605
+ this.key = _data["key"];
606
+ this.displayName = _data["displayName"];
607
+ this.type = _data["type"];
608
+ if (Array.isArray(_data["subOptions"])) {
609
+ this.subOptions = [];
610
+ for (let item of _data["subOptions"])
611
+ this.subOptions.push(Option.fromJS(item));
612
+ }
613
+ }
614
+ }
615
+ static fromJS(data) {
616
+ data = typeof data === 'object' ? data : {};
617
+ let result = new Option();
618
+ result.init(data);
619
+ return result;
620
+ }
621
+ toJSON(data) {
622
+ data = typeof data === 'object' ? data : {};
623
+ data["key"] = this.key;
624
+ data["displayName"] = this.displayName;
625
+ data["type"] = this.type;
626
+ if (Array.isArray(this.subOptions)) {
627
+ data["subOptions"] = [];
628
+ for (let item of this.subOptions)
629
+ data["subOptions"].push(item.toJSON());
630
+ }
631
+ return data;
632
+ }
633
+ }
634
+ export var OptionType;
635
+ (function (OptionType) {
636
+ OptionType[OptionType["None"] = 0] = "None";
637
+ OptionType[OptionType["Group"] = 1] = "Group";
638
+ OptionType[OptionType["Selectable"] = 2] = "Selectable";
639
+ })(OptionType || (OptionType = {}));
640
+ export class ScoredUrl {
641
+ constructor(data) {
642
+ Object.defineProperty(this, "url", {
643
+ enumerable: true,
644
+ configurable: true,
645
+ writable: true,
646
+ value: void 0
647
+ });
648
+ Object.defineProperty(this, "score", {
649
+ enumerable: true,
650
+ configurable: true,
651
+ writable: true,
652
+ value: void 0
653
+ });
654
+ Object.defineProperty(this, "title", {
655
+ enumerable: true,
656
+ configurable: true,
657
+ writable: true,
658
+ value: void 0
659
+ });
660
+ if (data) {
661
+ for (var property in data) {
662
+ if (data.hasOwnProperty(property))
663
+ this[property] = data[property];
664
+ }
665
+ }
666
+ }
667
+ init(_data) {
668
+ if (_data) {
669
+ this.url = _data["url"];
670
+ this.score = _data["score"];
671
+ this.title = _data["title"];
672
+ }
673
+ }
674
+ static fromJS(data) {
675
+ data = typeof data === 'object' ? data : {};
676
+ let result = new ScoredUrl();
677
+ result.init(data);
678
+ return result;
679
+ }
680
+ toJSON(data) {
681
+ data = typeof data === 'object' ? data : {};
682
+ data["url"] = this.url;
683
+ data["score"] = this.score;
684
+ data["title"] = this.title;
685
+ return data;
686
+ }
687
+ }
688
+ export class Selections {
689
+ constructor(data) {
690
+ Object.defineProperty(this, "values", {
691
+ enumerable: true,
692
+ configurable: true,
693
+ writable: true,
694
+ value: void 0
695
+ });
696
+ Object.defineProperty(this, "subOptions", {
697
+ enumerable: true,
698
+ configurable: true,
699
+ writable: true,
700
+ value: void 0
701
+ });
702
+ if (data) {
703
+ for (var property in data) {
704
+ if (data.hasOwnProperty(property))
705
+ this[property] = data[property];
706
+ }
707
+ }
708
+ }
709
+ init(_data) {
710
+ if (_data) {
711
+ if (Array.isArray(_data["values"])) {
712
+ this.values = [];
713
+ for (let item of _data["values"])
714
+ this.values.push(item);
715
+ }
716
+ if (_data["subOptions"]) {
717
+ this.subOptions = {};
718
+ for (let key in _data["subOptions"]) {
719
+ if (_data["subOptions"].hasOwnProperty(key))
720
+ this.subOptions[key] = _data["subOptions"][key] ? Selections.fromJS(_data["subOptions"][key]) : new Selections();
721
+ }
722
+ }
723
+ }
724
+ }
725
+ static fromJS(data) {
726
+ data = typeof data === 'object' ? data : {};
727
+ let result = new Selections();
728
+ result.init(data);
729
+ return result;
730
+ }
731
+ toJSON(data) {
732
+ data = typeof data === 'object' ? data : {};
733
+ if (Array.isArray(this.values)) {
734
+ data["values"] = [];
735
+ for (let item of this.values)
736
+ data["values"].push(item);
737
+ }
738
+ if (this.subOptions) {
739
+ data["subOptions"] = {};
740
+ for (let key in this.subOptions) {
741
+ if (this.subOptions.hasOwnProperty(key))
742
+ data["subOptions"][key] = this.subOptions[key] ? this.subOptions[key].toJSON() : undefined;
743
+ }
744
+ }
745
+ return data;
746
+ }
747
+ }
748
+ export class Session {
749
+ constructor(data) {
750
+ Object.defineProperty(this, "id", {
751
+ enumerable: true,
752
+ configurable: true,
753
+ writable: true,
754
+ value: void 0
755
+ });
756
+ Object.defineProperty(this, "data", {
757
+ enumerable: true,
758
+ configurable: true,
759
+ writable: true,
760
+ value: void 0
761
+ });
762
+ if (data) {
763
+ for (var property in data) {
764
+ if (data.hasOwnProperty(property))
765
+ this[property] = data[property];
766
+ }
767
+ }
768
+ }
769
+ init(_data) {
770
+ if (_data) {
771
+ this.id = _data["id"];
772
+ if (_data["data"]) {
773
+ this.data = {};
774
+ for (let key in _data["data"]) {
775
+ if (_data["data"].hasOwnProperty(key))
776
+ this.data[key] = _data["data"][key];
777
+ }
778
+ }
779
+ }
780
+ }
781
+ static fromJS(data) {
782
+ data = typeof data === 'object' ? data : {};
783
+ let result = new Session();
784
+ result.init(data);
785
+ return result;
786
+ }
787
+ toJSON(data) {
788
+ data = typeof data === 'object' ? data : {};
789
+ data["id"] = this.id;
790
+ if (this.data) {
791
+ data["data"] = {};
792
+ for (let key in this.data) {
793
+ if (this.data.hasOwnProperty(key))
794
+ data["data"][key] = this.data[key];
795
+ }
796
+ }
797
+ return data;
798
+ }
799
+ }
800
+ export class UserMessage {
801
+ constructor(data) {
802
+ Object.defineProperty(this, "sessionId", {
803
+ enumerable: true,
804
+ configurable: true,
805
+ writable: true,
806
+ value: void 0
807
+ });
808
+ Object.defineProperty(this, "question", {
809
+ enumerable: true,
810
+ configurable: true,
811
+ writable: true,
812
+ value: void 0
813
+ });
814
+ Object.defineProperty(this, "experience", {
815
+ enumerable: true,
816
+ configurable: true,
817
+ writable: true,
818
+ value: void 0
819
+ });
820
+ Object.defineProperty(this, "selections", {
821
+ enumerable: true,
822
+ configurable: true,
823
+ writable: true,
824
+ value: void 0
825
+ });
826
+ Object.defineProperty(this, "context", {
827
+ enumerable: true,
828
+ configurable: true,
829
+ writable: true,
830
+ value: void 0
831
+ });
832
+ if (data) {
833
+ for (var property in data) {
834
+ if (data.hasOwnProperty(property))
835
+ this[property] = data[property];
836
+ }
837
+ }
838
+ }
839
+ init(_data) {
840
+ if (_data) {
841
+ this.sessionId = _data["sessionId"];
842
+ this.question = _data["question"];
843
+ this.experience = _data["experience"];
844
+ this.selections = _data["selections"] ? Selections.fromJS(_data["selections"]) : undefined;
845
+ if (_data["context"]) {
846
+ this.context = {};
847
+ for (let key in _data["context"]) {
848
+ if (_data["context"].hasOwnProperty(key))
849
+ this.context[key] = _data["context"][key];
850
+ }
851
+ }
852
+ }
853
+ }
854
+ static fromJS(data) {
855
+ data = typeof data === 'object' ? data : {};
856
+ let result = new UserMessage();
857
+ result.init(data);
858
+ return result;
859
+ }
860
+ toJSON(data) {
861
+ data = typeof data === 'object' ? data : {};
862
+ data["sessionId"] = this.sessionId;
863
+ data["question"] = this.question;
864
+ data["experience"] = this.experience;
865
+ data["selections"] = this.selections ? this.selections.toJSON() : undefined;
866
+ if (this.context) {
867
+ data["context"] = {};
868
+ for (let key in this.context) {
869
+ if (this.context.hasOwnProperty(key))
870
+ data["context"][key] = this.context[key];
871
+ }
872
+ }
873
+ return data;
874
+ }
875
+ }
876
+ export class ApiException extends Error {
877
+ constructor(message, status, response, headers, result) {
878
+ super();
879
+ Object.defineProperty(this, "message", {
880
+ enumerable: true,
881
+ configurable: true,
882
+ writable: true,
883
+ value: void 0
884
+ });
885
+ Object.defineProperty(this, "status", {
886
+ enumerable: true,
887
+ configurable: true,
888
+ writable: true,
889
+ value: void 0
890
+ });
891
+ Object.defineProperty(this, "response", {
892
+ enumerable: true,
893
+ configurable: true,
894
+ writable: true,
895
+ value: void 0
896
+ });
897
+ Object.defineProperty(this, "headers", {
898
+ enumerable: true,
899
+ configurable: true,
900
+ writable: true,
901
+ value: void 0
902
+ });
903
+ Object.defineProperty(this, "result", {
904
+ enumerable: true,
905
+ configurable: true,
906
+ writable: true,
907
+ value: void 0
908
+ });
909
+ Object.defineProperty(this, "isApiException", {
910
+ enumerable: true,
911
+ configurable: true,
912
+ writable: true,
913
+ value: true
914
+ });
915
+ this.message = message;
916
+ this.status = status;
917
+ this.response = response;
918
+ this.headers = headers;
919
+ this.result = result;
920
+ }
921
+ static isApiException(obj) {
922
+ return obj.isApiException === true;
923
+ }
924
+ }
925
+ function throwException(message, status, response, headers, result) {
926
+ if (result !== null && result !== undefined)
927
+ throw result;
928
+ else
929
+ throw new ApiException(message, status, response, headers, null);
930
+ }
931
+ //# sourceMappingURL=native-client.js.map