@servicetitan/titan-chatbot-api 4.4.5 → 5.1.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.
- package/CHANGELOG.md +12 -0
- package/dist/api-client/titan-chat/chatbot-api-client.d.ts +1 -1
- package/dist/api-client/titan-chat/chatbot-api-client.d.ts.map +1 -1
- package/dist/api-client/titan-chat/chatbot-api-client.js +2 -2
- package/dist/api-client/titan-chat/chatbot-api-client.js.map +1 -1
- package/dist/api-client/titan-chat/native-client.d.ts +23 -13
- package/dist/api-client/titan-chat/native-client.d.ts.map +1 -1
- package/dist/api-client/titan-chat/native-client.js +529 -327
- package/dist/api-client/titan-chat/native-client.js.map +1 -1
- package/package.json +3 -3
- package/src/api-client/titan-chat/chatbot-api-client.ts +4 -3
- package/src/api-client/titan-chat/native-client.ts +716 -398
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
/* tslint:disable */
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
// ReSharper disable InconsistentNaming
|
|
9
|
+
import axios from 'axios';
|
|
9
10
|
export class Client {
|
|
10
|
-
constructor(baseUrl,
|
|
11
|
-
Object.defineProperty(this, "
|
|
11
|
+
constructor(baseUrl, instance) {
|
|
12
|
+
Object.defineProperty(this, "instance", {
|
|
12
13
|
enumerable: true,
|
|
13
14
|
configurable: true,
|
|
14
15
|
writable: true,
|
|
@@ -26,8 +27,8 @@ export class Client {
|
|
|
26
27
|
writable: true,
|
|
27
28
|
value: undefined
|
|
28
29
|
});
|
|
29
|
-
this.
|
|
30
|
-
this.baseUrl = baseUrl !== null && baseUrl !== void 0 ? baseUrl :
|
|
30
|
+
this.instance = instance || axios.create();
|
|
31
|
+
this.baseUrl = baseUrl !== null && baseUrl !== void 0 ? baseUrl : '';
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* @param x_Client_ID (optional)
|
|
@@ -35,45 +36,57 @@ export class Client {
|
|
|
35
36
|
* @return Success
|
|
36
37
|
*/
|
|
37
38
|
feedback(version, x_Client_ID, body, signal) {
|
|
38
|
-
let url_ = this.baseUrl +
|
|
39
|
+
let url_ = this.baseUrl + '/api/v{version}/feedback';
|
|
39
40
|
if (version === undefined || version === null)
|
|
40
41
|
throw new Error("The parameter 'version' must be defined.");
|
|
41
|
-
url_ = url_.replace(
|
|
42
|
-
url_ = url_.replace(/[?&]$/,
|
|
42
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
43
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
43
44
|
const content_ = JSON.stringify(body);
|
|
44
45
|
let options_ = {
|
|
45
|
-
|
|
46
|
-
method:
|
|
47
|
-
|
|
46
|
+
data: content_,
|
|
47
|
+
method: 'POST',
|
|
48
|
+
url: url_,
|
|
48
49
|
headers: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
50
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
'Accept': 'text/plain',
|
|
53
|
+
},
|
|
54
|
+
signal,
|
|
53
55
|
};
|
|
54
|
-
return this.
|
|
56
|
+
return this.instance
|
|
57
|
+
.request(options_)
|
|
58
|
+
.catch((_error) => {
|
|
59
|
+
if (isAxiosError(_error) && _error.response) {
|
|
60
|
+
return _error.response;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
throw _error;
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
.then((_response) => {
|
|
55
67
|
return this.processFeedback(_response);
|
|
56
68
|
});
|
|
57
69
|
}
|
|
58
70
|
processFeedback(response) {
|
|
59
71
|
const status = response.status;
|
|
60
72
|
let _headers = {};
|
|
61
|
-
if (response.headers && response.headers
|
|
62
|
-
|
|
73
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
74
|
+
for (const k in response.headers) {
|
|
75
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
76
|
+
_headers[k] = response.headers[k];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
63
79
|
}
|
|
64
|
-
;
|
|
65
80
|
if (status === 200) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
});
|
|
81
|
+
const _responseText = response.data;
|
|
82
|
+
let result200 = null;
|
|
83
|
+
let resultData200 = _responseText;
|
|
84
|
+
result200 = Feedback.fromJS(resultData200);
|
|
85
|
+
return Promise.resolve(result200);
|
|
72
86
|
}
|
|
73
87
|
else if (status !== 200 && status !== 204) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
88
|
+
const _responseText = response.data;
|
|
89
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
77
90
|
}
|
|
78
91
|
return Promise.resolve(null);
|
|
79
92
|
}
|
|
@@ -82,61 +95,142 @@ export class Client {
|
|
|
82
95
|
* @param body (optional)
|
|
83
96
|
* @return Success
|
|
84
97
|
*/
|
|
85
|
-
|
|
86
|
-
let url_ = this.baseUrl +
|
|
98
|
+
followUpEmail(version, x_Client_ID, body, signal) {
|
|
99
|
+
let url_ = this.baseUrl + '/api/v{version}/follow-up-email';
|
|
87
100
|
if (version === undefined || version === null)
|
|
88
101
|
throw new Error("The parameter 'version' must be defined.");
|
|
89
|
-
url_ = url_.replace(
|
|
90
|
-
url_ = url_.replace(/[?&]$/,
|
|
102
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
103
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
91
104
|
const content_ = JSON.stringify(body);
|
|
92
105
|
let options_ = {
|
|
93
|
-
|
|
94
|
-
method:
|
|
95
|
-
|
|
106
|
+
data: content_,
|
|
107
|
+
method: 'POST',
|
|
108
|
+
url: url_,
|
|
96
109
|
headers: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
111
|
+
'Content-Type': 'application/json',
|
|
112
|
+
'Accept': 'text/plain',
|
|
113
|
+
},
|
|
114
|
+
signal,
|
|
115
|
+
};
|
|
116
|
+
return this.instance
|
|
117
|
+
.request(options_)
|
|
118
|
+
.catch((_error) => {
|
|
119
|
+
if (isAxiosError(_error) && _error.response) {
|
|
120
|
+
return _error.response;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
throw _error;
|
|
100
124
|
}
|
|
125
|
+
})
|
|
126
|
+
.then((_response) => {
|
|
127
|
+
return this.processFollowUpEmail(_response);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
processFollowUpEmail(response) {
|
|
131
|
+
const status = response.status;
|
|
132
|
+
let _headers = {};
|
|
133
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
134
|
+
for (const k in response.headers) {
|
|
135
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
136
|
+
_headers[k] = response.headers[k];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (status === 200) {
|
|
141
|
+
const _responseText = response.data;
|
|
142
|
+
let result200 = null;
|
|
143
|
+
let resultData200 = _responseText;
|
|
144
|
+
result200 = BotMessage.fromJS(resultData200);
|
|
145
|
+
return Promise.resolve(result200);
|
|
146
|
+
}
|
|
147
|
+
else if (status === 500) {
|
|
148
|
+
const _responseText = response.data;
|
|
149
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
150
|
+
}
|
|
151
|
+
else if (status === 502) {
|
|
152
|
+
const _responseText = response.data;
|
|
153
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
154
|
+
}
|
|
155
|
+
else if (status === 504) {
|
|
156
|
+
const _responseText = response.data;
|
|
157
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
158
|
+
}
|
|
159
|
+
else if (status !== 200 && status !== 204) {
|
|
160
|
+
const _responseText = response.data;
|
|
161
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
162
|
+
}
|
|
163
|
+
return Promise.resolve(null);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* @param x_Client_ID (optional)
|
|
167
|
+
* @param body (optional)
|
|
168
|
+
* @return Success
|
|
169
|
+
*/
|
|
170
|
+
message(version, x_Client_ID, body, signal) {
|
|
171
|
+
let url_ = this.baseUrl + '/api/v{version}/message';
|
|
172
|
+
if (version === undefined || version === null)
|
|
173
|
+
throw new Error("The parameter 'version' must be defined.");
|
|
174
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
175
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
176
|
+
const content_ = JSON.stringify(body);
|
|
177
|
+
let options_ = {
|
|
178
|
+
data: content_,
|
|
179
|
+
method: 'POST',
|
|
180
|
+
url: url_,
|
|
181
|
+
headers: {
|
|
182
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
183
|
+
'Content-Type': 'application/json',
|
|
184
|
+
'Accept': 'text/plain',
|
|
185
|
+
},
|
|
186
|
+
signal,
|
|
101
187
|
};
|
|
102
|
-
return this.
|
|
188
|
+
return this.instance
|
|
189
|
+
.request(options_)
|
|
190
|
+
.catch((_error) => {
|
|
191
|
+
if (isAxiosError(_error) && _error.response) {
|
|
192
|
+
return _error.response;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
throw _error;
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
.then((_response) => {
|
|
103
199
|
return this.processMessage(_response);
|
|
104
200
|
});
|
|
105
201
|
}
|
|
106
202
|
processMessage(response) {
|
|
107
203
|
const status = response.status;
|
|
108
204
|
let _headers = {};
|
|
109
|
-
if (response.headers && response.headers
|
|
110
|
-
|
|
205
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
206
|
+
for (const k in response.headers) {
|
|
207
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
208
|
+
_headers[k] = response.headers[k];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
111
211
|
}
|
|
112
|
-
;
|
|
113
212
|
if (status === 200) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
213
|
+
const _responseText = response.data;
|
|
214
|
+
let result200 = null;
|
|
215
|
+
let resultData200 = _responseText;
|
|
216
|
+
result200 = BotMessage.fromJS(resultData200);
|
|
217
|
+
return Promise.resolve(result200);
|
|
120
218
|
}
|
|
121
219
|
else if (status === 500) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
});
|
|
220
|
+
const _responseText = response.data;
|
|
221
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
125
222
|
}
|
|
126
223
|
else if (status === 502) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
});
|
|
224
|
+
const _responseText = response.data;
|
|
225
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
130
226
|
}
|
|
131
227
|
else if (status === 504) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
228
|
+
const _responseText = response.data;
|
|
229
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
135
230
|
}
|
|
136
231
|
else if (status !== 200 && status !== 204) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
});
|
|
232
|
+
const _responseText = response.data;
|
|
233
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
140
234
|
}
|
|
141
235
|
return Promise.resolve(null);
|
|
142
236
|
}
|
|
@@ -145,42 +239,54 @@ export class Client {
|
|
|
145
239
|
* @return Success
|
|
146
240
|
*/
|
|
147
241
|
options(version, x_Client_ID, signal) {
|
|
148
|
-
let url_ = this.baseUrl +
|
|
242
|
+
let url_ = this.baseUrl + '/api/v{version}/options';
|
|
149
243
|
if (version === undefined || version === null)
|
|
150
244
|
throw new Error("The parameter 'version' must be defined.");
|
|
151
|
-
url_ = url_.replace(
|
|
152
|
-
url_ = url_.replace(/[?&]$/,
|
|
245
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
246
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
153
247
|
let options_ = {
|
|
154
|
-
method:
|
|
155
|
-
|
|
248
|
+
method: 'GET',
|
|
249
|
+
url: url_,
|
|
156
250
|
headers: {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
251
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
252
|
+
'Accept': 'text/plain',
|
|
253
|
+
},
|
|
254
|
+
signal,
|
|
160
255
|
};
|
|
161
|
-
return this.
|
|
256
|
+
return this.instance
|
|
257
|
+
.request(options_)
|
|
258
|
+
.catch((_error) => {
|
|
259
|
+
if (isAxiosError(_error) && _error.response) {
|
|
260
|
+
return _error.response;
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
throw _error;
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
.then((_response) => {
|
|
162
267
|
return this.processOptions(_response);
|
|
163
268
|
});
|
|
164
269
|
}
|
|
165
270
|
processOptions(response) {
|
|
166
271
|
const status = response.status;
|
|
167
272
|
let _headers = {};
|
|
168
|
-
if (response.headers && response.headers
|
|
169
|
-
|
|
273
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
274
|
+
for (const k in response.headers) {
|
|
275
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
276
|
+
_headers[k] = response.headers[k];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
170
279
|
}
|
|
171
|
-
;
|
|
172
280
|
if (status === 200) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
});
|
|
281
|
+
const _responseText = response.data;
|
|
282
|
+
let result200 = null;
|
|
283
|
+
let resultData200 = _responseText;
|
|
284
|
+
result200 = FrontendModel.fromJS(resultData200);
|
|
285
|
+
return Promise.resolve(result200);
|
|
179
286
|
}
|
|
180
287
|
else if (status !== 200 && status !== 204) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
});
|
|
288
|
+
const _responseText = response.data;
|
|
289
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
184
290
|
}
|
|
185
291
|
return Promise.resolve(null);
|
|
186
292
|
}
|
|
@@ -190,45 +296,57 @@ export class Client {
|
|
|
190
296
|
* @return Success
|
|
191
297
|
*/
|
|
192
298
|
sessionPOST(version, x_Client_ID, body, signal) {
|
|
193
|
-
let url_ = this.baseUrl +
|
|
299
|
+
let url_ = this.baseUrl + '/api/v{version}/session';
|
|
194
300
|
if (version === undefined || version === null)
|
|
195
301
|
throw new Error("The parameter 'version' must be defined.");
|
|
196
|
-
url_ = url_.replace(
|
|
197
|
-
url_ = url_.replace(/[?&]$/,
|
|
302
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
303
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
198
304
|
const content_ = JSON.stringify(body);
|
|
199
305
|
let options_ = {
|
|
200
|
-
|
|
201
|
-
method:
|
|
202
|
-
|
|
306
|
+
data: content_,
|
|
307
|
+
method: 'POST',
|
|
308
|
+
url: url_,
|
|
203
309
|
headers: {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
310
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
311
|
+
'Content-Type': 'application/json',
|
|
312
|
+
'Accept': 'text/plain',
|
|
313
|
+
},
|
|
314
|
+
signal,
|
|
208
315
|
};
|
|
209
|
-
return this.
|
|
316
|
+
return this.instance
|
|
317
|
+
.request(options_)
|
|
318
|
+
.catch((_error) => {
|
|
319
|
+
if (isAxiosError(_error) && _error.response) {
|
|
320
|
+
return _error.response;
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
throw _error;
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
.then((_response) => {
|
|
210
327
|
return this.processSessionPOST(_response);
|
|
211
328
|
});
|
|
212
329
|
}
|
|
213
330
|
processSessionPOST(response) {
|
|
214
331
|
const status = response.status;
|
|
215
332
|
let _headers = {};
|
|
216
|
-
if (response.headers && response.headers
|
|
217
|
-
|
|
333
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
334
|
+
for (const k in response.headers) {
|
|
335
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
336
|
+
_headers[k] = response.headers[k];
|
|
337
|
+
}
|
|
338
|
+
}
|
|
218
339
|
}
|
|
219
|
-
;
|
|
220
340
|
if (status === 200) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
});
|
|
341
|
+
const _responseText = response.data;
|
|
342
|
+
let result200 = null;
|
|
343
|
+
let resultData200 = _responseText;
|
|
344
|
+
result200 = Session.fromJS(resultData200);
|
|
345
|
+
return Promise.resolve(result200);
|
|
227
346
|
}
|
|
228
347
|
else if (status !== 200 && status !== 204) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
});
|
|
348
|
+
const _responseText = response.data;
|
|
349
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
232
350
|
}
|
|
233
351
|
return Promise.resolve(null);
|
|
234
352
|
}
|
|
@@ -238,45 +356,57 @@ export class Client {
|
|
|
238
356
|
* @return Success
|
|
239
357
|
*/
|
|
240
358
|
sessionPATCH(version, x_Client_ID, body, signal) {
|
|
241
|
-
let url_ = this.baseUrl +
|
|
359
|
+
let url_ = this.baseUrl + '/api/v{version}/session';
|
|
242
360
|
if (version === undefined || version === null)
|
|
243
361
|
throw new Error("The parameter 'version' must be defined.");
|
|
244
|
-
url_ = url_.replace(
|
|
245
|
-
url_ = url_.replace(/[?&]$/,
|
|
362
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
363
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
246
364
|
const content_ = JSON.stringify(body);
|
|
247
365
|
let options_ = {
|
|
248
|
-
|
|
249
|
-
method:
|
|
250
|
-
|
|
366
|
+
data: content_,
|
|
367
|
+
method: 'PATCH',
|
|
368
|
+
url: url_,
|
|
251
369
|
headers: {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
370
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
371
|
+
'Content-Type': 'application/json',
|
|
372
|
+
'Accept': 'text/plain',
|
|
373
|
+
},
|
|
374
|
+
signal,
|
|
256
375
|
};
|
|
257
|
-
return this.
|
|
376
|
+
return this.instance
|
|
377
|
+
.request(options_)
|
|
378
|
+
.catch((_error) => {
|
|
379
|
+
if (isAxiosError(_error) && _error.response) {
|
|
380
|
+
return _error.response;
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
throw _error;
|
|
384
|
+
}
|
|
385
|
+
})
|
|
386
|
+
.then((_response) => {
|
|
258
387
|
return this.processSessionPATCH(_response);
|
|
259
388
|
});
|
|
260
389
|
}
|
|
261
390
|
processSessionPATCH(response) {
|
|
262
391
|
const status = response.status;
|
|
263
392
|
let _headers = {};
|
|
264
|
-
if (response.headers && response.headers
|
|
265
|
-
|
|
393
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
394
|
+
for (const k in response.headers) {
|
|
395
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
396
|
+
_headers[k] = response.headers[k];
|
|
397
|
+
}
|
|
398
|
+
}
|
|
266
399
|
}
|
|
267
|
-
;
|
|
268
400
|
if (status === 200) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
});
|
|
401
|
+
const _responseText = response.data;
|
|
402
|
+
let result200 = null;
|
|
403
|
+
let resultData200 = _responseText;
|
|
404
|
+
result200 = Session.fromJS(resultData200);
|
|
405
|
+
return Promise.resolve(result200);
|
|
275
406
|
}
|
|
276
407
|
else if (status !== 200 && status !== 204) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
});
|
|
408
|
+
const _responseText = response.data;
|
|
409
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
280
410
|
}
|
|
281
411
|
return Promise.resolve(null);
|
|
282
412
|
}
|
|
@@ -286,45 +416,57 @@ export class Client {
|
|
|
286
416
|
* @return Success
|
|
287
417
|
*/
|
|
288
418
|
sessionDELETE(version, x_Client_ID, body, signal) {
|
|
289
|
-
let url_ = this.baseUrl +
|
|
419
|
+
let url_ = this.baseUrl + '/api/v{version}/session';
|
|
290
420
|
if (version === undefined || version === null)
|
|
291
421
|
throw new Error("The parameter 'version' must be defined.");
|
|
292
|
-
url_ = url_.replace(
|
|
293
|
-
url_ = url_.replace(/[?&]$/,
|
|
422
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
423
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
294
424
|
const content_ = JSON.stringify(body);
|
|
295
425
|
let options_ = {
|
|
296
|
-
|
|
297
|
-
method:
|
|
298
|
-
|
|
426
|
+
data: content_,
|
|
427
|
+
method: 'DELETE',
|
|
428
|
+
url: url_,
|
|
299
429
|
headers: {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
430
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
431
|
+
'Content-Type': 'application/json',
|
|
432
|
+
'Accept': 'text/plain',
|
|
433
|
+
},
|
|
434
|
+
signal,
|
|
304
435
|
};
|
|
305
|
-
return this.
|
|
436
|
+
return this.instance
|
|
437
|
+
.request(options_)
|
|
438
|
+
.catch((_error) => {
|
|
439
|
+
if (isAxiosError(_error) && _error.response) {
|
|
440
|
+
return _error.response;
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
throw _error;
|
|
444
|
+
}
|
|
445
|
+
})
|
|
446
|
+
.then((_response) => {
|
|
306
447
|
return this.processSessionDELETE(_response);
|
|
307
448
|
});
|
|
308
449
|
}
|
|
309
450
|
processSessionDELETE(response) {
|
|
310
451
|
const status = response.status;
|
|
311
452
|
let _headers = {};
|
|
312
|
-
if (response.headers && response.headers
|
|
313
|
-
|
|
453
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
454
|
+
for (const k in response.headers) {
|
|
455
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
456
|
+
_headers[k] = response.headers[k];
|
|
457
|
+
}
|
|
458
|
+
}
|
|
314
459
|
}
|
|
315
|
-
;
|
|
316
460
|
if (status === 200) {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
});
|
|
461
|
+
const _responseText = response.data;
|
|
462
|
+
let result200 = null;
|
|
463
|
+
let resultData200 = _responseText;
|
|
464
|
+
result200 = Session.fromJS(resultData200);
|
|
465
|
+
return Promise.resolve(result200);
|
|
323
466
|
}
|
|
324
467
|
else if (status !== 200 && status !== 204) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
});
|
|
468
|
+
const _responseText = response.data;
|
|
469
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
328
470
|
}
|
|
329
471
|
return Promise.resolve(null);
|
|
330
472
|
}
|
|
@@ -335,57 +477,69 @@ export class Client {
|
|
|
335
477
|
* @return Success
|
|
336
478
|
*/
|
|
337
479
|
transcripts(start, end, version, x_Client_ID, signal) {
|
|
338
|
-
let url_ = this.baseUrl +
|
|
480
|
+
let url_ = this.baseUrl + '/api/v{version}/transcripts?';
|
|
339
481
|
if (version === undefined || version === null)
|
|
340
482
|
throw new Error("The parameter 'version' must be defined.");
|
|
341
|
-
url_ = url_.replace(
|
|
483
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
342
484
|
if (start === null)
|
|
343
485
|
throw new Error("The parameter 'start' cannot be null.");
|
|
344
486
|
else if (start !== undefined)
|
|
345
|
-
url_ +=
|
|
487
|
+
url_ += 'start=' + encodeURIComponent(start ? '' + start.toISOString() : '') + '&';
|
|
346
488
|
if (end === null)
|
|
347
489
|
throw new Error("The parameter 'end' cannot be null.");
|
|
348
490
|
else if (end !== undefined)
|
|
349
|
-
url_ +=
|
|
350
|
-
url_ = url_.replace(/[?&]$/,
|
|
491
|
+
url_ += 'end=' + encodeURIComponent(end ? '' + end.toISOString() : '') + '&';
|
|
492
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
351
493
|
let options_ = {
|
|
352
|
-
method:
|
|
353
|
-
|
|
494
|
+
method: 'GET',
|
|
495
|
+
url: url_,
|
|
354
496
|
headers: {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
497
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
498
|
+
'Accept': 'text/plain',
|
|
499
|
+
},
|
|
500
|
+
signal,
|
|
358
501
|
};
|
|
359
|
-
return this.
|
|
502
|
+
return this.instance
|
|
503
|
+
.request(options_)
|
|
504
|
+
.catch((_error) => {
|
|
505
|
+
if (isAxiosError(_error) && _error.response) {
|
|
506
|
+
return _error.response;
|
|
507
|
+
}
|
|
508
|
+
else {
|
|
509
|
+
throw _error;
|
|
510
|
+
}
|
|
511
|
+
})
|
|
512
|
+
.then((_response) => {
|
|
360
513
|
return this.processTranscripts(_response);
|
|
361
514
|
});
|
|
362
515
|
}
|
|
363
516
|
processTranscripts(response) {
|
|
364
517
|
const status = response.status;
|
|
365
518
|
let _headers = {};
|
|
366
|
-
if (response.headers && response.headers
|
|
367
|
-
|
|
519
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
520
|
+
for (const k in response.headers) {
|
|
521
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
522
|
+
_headers[k] = response.headers[k];
|
|
523
|
+
}
|
|
524
|
+
}
|
|
368
525
|
}
|
|
369
|
-
;
|
|
370
526
|
if (status === 200) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
});
|
|
527
|
+
const _responseText = response.data;
|
|
528
|
+
let result200 = null;
|
|
529
|
+
let resultData200 = _responseText;
|
|
530
|
+
if (Array.isArray(resultData200)) {
|
|
531
|
+
result200 = [];
|
|
532
|
+
for (let item of resultData200)
|
|
533
|
+
result200.push(ExportHistoryMessage.fromJS(item));
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
result200 = null;
|
|
537
|
+
}
|
|
538
|
+
return Promise.resolve(result200);
|
|
384
539
|
}
|
|
385
540
|
else if (status !== 200 && status !== 204) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
});
|
|
541
|
+
const _responseText = response.data;
|
|
542
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
389
543
|
}
|
|
390
544
|
return Promise.resolve(null);
|
|
391
545
|
}
|
|
@@ -395,46 +549,58 @@ export class Client {
|
|
|
395
549
|
* @return Success
|
|
396
550
|
*/
|
|
397
551
|
summary(sessionId, version, x_Client_ID, signal) {
|
|
398
|
-
let url_ = this.baseUrl +
|
|
552
|
+
let url_ = this.baseUrl + '/api/v{version}/transcripts/summary?';
|
|
399
553
|
if (version === undefined || version === null)
|
|
400
554
|
throw new Error("The parameter 'version' must be defined.");
|
|
401
|
-
url_ = url_.replace(
|
|
555
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
402
556
|
if (sessionId === null)
|
|
403
557
|
throw new Error("The parameter 'sessionId' cannot be null.");
|
|
404
558
|
else if (sessionId !== undefined)
|
|
405
|
-
url_ +=
|
|
406
|
-
url_ = url_.replace(/[?&]$/,
|
|
559
|
+
url_ += 'sessionId=' + encodeURIComponent('' + sessionId) + '&';
|
|
560
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
407
561
|
let options_ = {
|
|
408
|
-
method:
|
|
409
|
-
|
|
562
|
+
method: 'GET',
|
|
563
|
+
url: url_,
|
|
410
564
|
headers: {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
565
|
+
'X-Client-ID': x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
566
|
+
'Accept': 'text/plain',
|
|
567
|
+
},
|
|
568
|
+
signal,
|
|
414
569
|
};
|
|
415
|
-
return this.
|
|
570
|
+
return this.instance
|
|
571
|
+
.request(options_)
|
|
572
|
+
.catch((_error) => {
|
|
573
|
+
if (isAxiosError(_error) && _error.response) {
|
|
574
|
+
return _error.response;
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
throw _error;
|
|
578
|
+
}
|
|
579
|
+
})
|
|
580
|
+
.then((_response) => {
|
|
416
581
|
return this.processSummary(_response);
|
|
417
582
|
});
|
|
418
583
|
}
|
|
419
584
|
processSummary(response) {
|
|
420
585
|
const status = response.status;
|
|
421
586
|
let _headers = {};
|
|
422
|
-
if (response.headers && response.headers
|
|
423
|
-
|
|
587
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
588
|
+
for (const k in response.headers) {
|
|
589
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
590
|
+
_headers[k] = response.headers[k];
|
|
591
|
+
}
|
|
592
|
+
}
|
|
424
593
|
}
|
|
425
|
-
;
|
|
426
594
|
if (status === 200) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
});
|
|
595
|
+
const _responseText = response.data;
|
|
596
|
+
let result200 = null;
|
|
597
|
+
let resultData200 = _responseText;
|
|
598
|
+
result200 = resultData200 !== undefined ? resultData200 : null;
|
|
599
|
+
return Promise.resolve(result200);
|
|
433
600
|
}
|
|
434
601
|
else if (status !== 200 && status !== 204) {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
});
|
|
602
|
+
const _responseText = response.data;
|
|
603
|
+
return throwException('An unexpected server error occurred.', status, _responseText, _headers);
|
|
438
604
|
}
|
|
439
605
|
return Promise.resolve(null);
|
|
440
606
|
}
|
|
@@ -516,6 +682,13 @@ export class BotMessage {
|
|
|
516
682
|
writable: true,
|
|
517
683
|
value: void 0
|
|
518
684
|
});
|
|
685
|
+
/** How confident is the chatbot in its response. */
|
|
686
|
+
Object.defineProperty(this, "confidenceScore", {
|
|
687
|
+
enumerable: true,
|
|
688
|
+
configurable: true,
|
|
689
|
+
writable: true,
|
|
690
|
+
value: void 0
|
|
691
|
+
});
|
|
519
692
|
if (data) {
|
|
520
693
|
for (var property in data) {
|
|
521
694
|
if (data.hasOwnProperty(property))
|
|
@@ -525,20 +698,23 @@ export class BotMessage {
|
|
|
525
698
|
}
|
|
526
699
|
init(_data) {
|
|
527
700
|
if (_data) {
|
|
528
|
-
this.id = _data[
|
|
529
|
-
this.sessionId = _data[
|
|
530
|
-
this.timeStamp = _data[
|
|
531
|
-
|
|
532
|
-
|
|
701
|
+
this.id = _data['id'];
|
|
702
|
+
this.sessionId = _data['sessionId'];
|
|
703
|
+
this.timeStamp = _data['timeStamp']
|
|
704
|
+
? new Date(_data['timeStamp'].toString())
|
|
705
|
+
: undefined;
|
|
706
|
+
this.answer = _data['answer'];
|
|
707
|
+
if (Array.isArray(_data['scoredUrls'])) {
|
|
533
708
|
this.scoredUrls = [];
|
|
534
|
-
for (let item of _data[
|
|
709
|
+
for (let item of _data['scoredUrls'])
|
|
535
710
|
this.scoredUrls.push(ScoredUrl.fromJS(item));
|
|
536
711
|
}
|
|
537
|
-
this.guardFlag = _data[
|
|
538
|
-
this.isGuardrailed = _data[
|
|
539
|
-
this.botVersion = _data[
|
|
540
|
-
this.modelVersion = _data[
|
|
541
|
-
this.meta = _data[
|
|
712
|
+
this.guardFlag = _data['guardFlag'];
|
|
713
|
+
this.isGuardrailed = _data['isGuardrailed'];
|
|
714
|
+
this.botVersion = _data['botVersion'];
|
|
715
|
+
this.modelVersion = _data['modelVersion'];
|
|
716
|
+
this.meta = _data['meta'];
|
|
717
|
+
this.confidenceScore = _data['confidenceScore'];
|
|
542
718
|
}
|
|
543
719
|
}
|
|
544
720
|
static fromJS(data) {
|
|
@@ -549,20 +725,21 @@ export class BotMessage {
|
|
|
549
725
|
}
|
|
550
726
|
toJSON(data) {
|
|
551
727
|
data = typeof data === 'object' ? data : {};
|
|
552
|
-
data[
|
|
553
|
-
data[
|
|
554
|
-
data[
|
|
555
|
-
data[
|
|
728
|
+
data['id'] = this.id;
|
|
729
|
+
data['sessionId'] = this.sessionId;
|
|
730
|
+
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : undefined;
|
|
731
|
+
data['answer'] = this.answer;
|
|
556
732
|
if (Array.isArray(this.scoredUrls)) {
|
|
557
|
-
data[
|
|
733
|
+
data['scoredUrls'] = [];
|
|
558
734
|
for (let item of this.scoredUrls)
|
|
559
|
-
data[
|
|
735
|
+
data['scoredUrls'].push(item.toJSON());
|
|
560
736
|
}
|
|
561
|
-
data[
|
|
562
|
-
data[
|
|
563
|
-
data[
|
|
564
|
-
data[
|
|
565
|
-
data[
|
|
737
|
+
data['guardFlag'] = this.guardFlag;
|
|
738
|
+
data['isGuardrailed'] = this.isGuardrailed;
|
|
739
|
+
data['botVersion'] = this.botVersion;
|
|
740
|
+
data['modelVersion'] = this.modelVersion;
|
|
741
|
+
data['meta'] = this.meta;
|
|
742
|
+
data['confidenceScore'] = this.confidenceScore;
|
|
566
743
|
return data;
|
|
567
744
|
}
|
|
568
745
|
}
|
|
@@ -692,24 +869,32 @@ export class ExportHistoryMessage {
|
|
|
692
869
|
}
|
|
693
870
|
init(_data) {
|
|
694
871
|
if (_data) {
|
|
695
|
-
this.id = _data[
|
|
696
|
-
this.sessionId = _data[
|
|
697
|
-
this.timeStamp = _data[
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
this.
|
|
701
|
-
this.
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
this.
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
this.
|
|
708
|
-
this.
|
|
709
|
-
this.
|
|
710
|
-
this.
|
|
711
|
-
this.
|
|
712
|
-
this.
|
|
872
|
+
this.id = _data['id'];
|
|
873
|
+
this.sessionId = _data['sessionId'];
|
|
874
|
+
this.timeStamp = _data['timeStamp']
|
|
875
|
+
? new Date(_data['timeStamp'].toString())
|
|
876
|
+
: undefined;
|
|
877
|
+
this.userId = _data['userId'];
|
|
878
|
+
this.sessionStartTime = _data['sessionStartTime']
|
|
879
|
+
? new Date(_data['sessionStartTime'].toString())
|
|
880
|
+
: undefined;
|
|
881
|
+
this.sessionEndTime = _data['sessionEndTime']
|
|
882
|
+
? new Date(_data['sessionEndTime'].toString())
|
|
883
|
+
: undefined;
|
|
884
|
+
this.userName = _data['userName'];
|
|
885
|
+
this.userEmail = _data['userEmail'];
|
|
886
|
+
this.question = _data['question'];
|
|
887
|
+
this.answer = _data['answer'];
|
|
888
|
+
this.messageType = _data['messageType'];
|
|
889
|
+
this.salesforceCaseId = _data['salesforceCaseId'];
|
|
890
|
+
this.guardFlag = _data['guardFlag'];
|
|
891
|
+
this.isGuardrailed = _data['isGuardrailed'];
|
|
892
|
+
this.botVersion = _data['botVersion'];
|
|
893
|
+
this.metadata = _data['metadata'];
|
|
894
|
+
this.feedback = _data['feedback'] ? Feedback.fromJS(_data['feedback']) : undefined;
|
|
895
|
+
this.sessionFeedback = _data['sessionFeedback']
|
|
896
|
+
? Feedback.fromJS(_data['sessionFeedback'])
|
|
897
|
+
: undefined;
|
|
713
898
|
}
|
|
714
899
|
}
|
|
715
900
|
static fromJS(data) {
|
|
@@ -720,24 +905,30 @@ export class ExportHistoryMessage {
|
|
|
720
905
|
}
|
|
721
906
|
toJSON(data) {
|
|
722
907
|
data = typeof data === 'object' ? data : {};
|
|
723
|
-
data[
|
|
724
|
-
data[
|
|
725
|
-
data[
|
|
726
|
-
data[
|
|
727
|
-
data[
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
data[
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
data[
|
|
734
|
-
data[
|
|
735
|
-
data[
|
|
736
|
-
data[
|
|
737
|
-
data[
|
|
738
|
-
data[
|
|
739
|
-
data[
|
|
740
|
-
data[
|
|
908
|
+
data['id'] = this.id;
|
|
909
|
+
data['sessionId'] = this.sessionId;
|
|
910
|
+
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : undefined;
|
|
911
|
+
data['userId'] = this.userId;
|
|
912
|
+
data['sessionStartTime'] = this.sessionStartTime
|
|
913
|
+
? this.sessionStartTime.toISOString()
|
|
914
|
+
: undefined;
|
|
915
|
+
data['sessionEndTime'] = this.sessionEndTime
|
|
916
|
+
? this.sessionEndTime.toISOString()
|
|
917
|
+
: undefined;
|
|
918
|
+
data['userName'] = this.userName;
|
|
919
|
+
data['userEmail'] = this.userEmail;
|
|
920
|
+
data['question'] = this.question;
|
|
921
|
+
data['answer'] = this.answer;
|
|
922
|
+
data['messageType'] = this.messageType;
|
|
923
|
+
data['salesforceCaseId'] = this.salesforceCaseId;
|
|
924
|
+
data['guardFlag'] = this.guardFlag;
|
|
925
|
+
data['isGuardrailed'] = this.isGuardrailed;
|
|
926
|
+
data['botVersion'] = this.botVersion;
|
|
927
|
+
data['metadata'] = this.metadata;
|
|
928
|
+
data['feedback'] = this.feedback ? this.feedback.toJSON() : undefined;
|
|
929
|
+
data['sessionFeedback'] = this.sessionFeedback
|
|
930
|
+
? this.sessionFeedback.toJSON()
|
|
931
|
+
: undefined;
|
|
741
932
|
return data;
|
|
742
933
|
}
|
|
743
934
|
}
|
|
@@ -794,16 +985,16 @@ export class Feedback {
|
|
|
794
985
|
}
|
|
795
986
|
init(_data) {
|
|
796
987
|
if (_data) {
|
|
797
|
-
this.linkUrl = _data[
|
|
798
|
-
this.description = _data[
|
|
799
|
-
this.sessionId = _data[
|
|
800
|
-
this.messageId = _data[
|
|
801
|
-
if (Array.isArray(_data[
|
|
988
|
+
this.linkUrl = _data['linkUrl'];
|
|
989
|
+
this.description = _data['description'];
|
|
990
|
+
this.sessionId = _data['sessionId'];
|
|
991
|
+
this.messageId = _data['messageId'];
|
|
992
|
+
if (Array.isArray(_data['options'])) {
|
|
802
993
|
this.options = [];
|
|
803
|
-
for (let item of _data[
|
|
994
|
+
for (let item of _data['options'])
|
|
804
995
|
this.options.push(item);
|
|
805
996
|
}
|
|
806
|
-
this.rating = _data[
|
|
997
|
+
this.rating = _data['rating'];
|
|
807
998
|
}
|
|
808
999
|
}
|
|
809
1000
|
static fromJS(data) {
|
|
@@ -814,16 +1005,16 @@ export class Feedback {
|
|
|
814
1005
|
}
|
|
815
1006
|
toJSON(data) {
|
|
816
1007
|
data = typeof data === 'object' ? data : {};
|
|
817
|
-
data[
|
|
818
|
-
data[
|
|
819
|
-
data[
|
|
820
|
-
data[
|
|
1008
|
+
data['linkUrl'] = this.linkUrl;
|
|
1009
|
+
data['description'] = this.description;
|
|
1010
|
+
data['sessionId'] = this.sessionId;
|
|
1011
|
+
data['messageId'] = this.messageId;
|
|
821
1012
|
if (Array.isArray(this.options)) {
|
|
822
|
-
data[
|
|
1013
|
+
data['options'] = [];
|
|
823
1014
|
for (let item of this.options)
|
|
824
|
-
data[
|
|
1015
|
+
data['options'].push(item);
|
|
825
1016
|
}
|
|
826
|
-
data[
|
|
1017
|
+
data['rating'] = this.rating;
|
|
827
1018
|
return data;
|
|
828
1019
|
}
|
|
829
1020
|
}
|
|
@@ -861,7 +1052,7 @@ export class FrontendModel {
|
|
|
861
1052
|
}
|
|
862
1053
|
init(_data) {
|
|
863
1054
|
if (_data) {
|
|
864
|
-
this.options = _data[
|
|
1055
|
+
this.options = _data['options'] ? Option.fromJS(_data['options']) : new Option();
|
|
865
1056
|
}
|
|
866
1057
|
}
|
|
867
1058
|
static fromJS(data) {
|
|
@@ -872,7 +1063,7 @@ export class FrontendModel {
|
|
|
872
1063
|
}
|
|
873
1064
|
toJSON(data) {
|
|
874
1065
|
data = typeof data === 'object' ? data : {};
|
|
875
|
-
data[
|
|
1066
|
+
data['options'] = this.options ? this.options.toJSON() : undefined;
|
|
876
1067
|
return data;
|
|
877
1068
|
}
|
|
878
1069
|
}
|
|
@@ -915,12 +1106,12 @@ export class Option {
|
|
|
915
1106
|
}
|
|
916
1107
|
init(_data) {
|
|
917
1108
|
if (_data) {
|
|
918
|
-
this.key = _data[
|
|
919
|
-
this.displayName = _data[
|
|
920
|
-
this.type = _data[
|
|
921
|
-
if (Array.isArray(_data[
|
|
1109
|
+
this.key = _data['key'];
|
|
1110
|
+
this.displayName = _data['displayName'];
|
|
1111
|
+
this.type = _data['type'];
|
|
1112
|
+
if (Array.isArray(_data['subOptions'])) {
|
|
922
1113
|
this.subOptions = [];
|
|
923
|
-
for (let item of _data[
|
|
1114
|
+
for (let item of _data['subOptions'])
|
|
924
1115
|
this.subOptions.push(Option.fromJS(item));
|
|
925
1116
|
}
|
|
926
1117
|
}
|
|
@@ -933,13 +1124,13 @@ export class Option {
|
|
|
933
1124
|
}
|
|
934
1125
|
toJSON(data) {
|
|
935
1126
|
data = typeof data === 'object' ? data : {};
|
|
936
|
-
data[
|
|
937
|
-
data[
|
|
938
|
-
data[
|
|
1127
|
+
data['key'] = this.key;
|
|
1128
|
+
data['displayName'] = this.displayName;
|
|
1129
|
+
data['type'] = this.type;
|
|
939
1130
|
if (Array.isArray(this.subOptions)) {
|
|
940
|
-
data[
|
|
1131
|
+
data['subOptions'] = [];
|
|
941
1132
|
for (let item of this.subOptions)
|
|
942
|
-
data[
|
|
1133
|
+
data['subOptions'].push(item.toJSON());
|
|
943
1134
|
}
|
|
944
1135
|
return data;
|
|
945
1136
|
}
|
|
@@ -980,9 +1171,9 @@ export class ScoredUrl {
|
|
|
980
1171
|
}
|
|
981
1172
|
init(_data) {
|
|
982
1173
|
if (_data) {
|
|
983
|
-
this.url = _data[
|
|
984
|
-
this.score = _data[
|
|
985
|
-
this.title = _data[
|
|
1174
|
+
this.url = _data['url'];
|
|
1175
|
+
this.score = _data['score'];
|
|
1176
|
+
this.title = _data['title'];
|
|
986
1177
|
}
|
|
987
1178
|
}
|
|
988
1179
|
static fromJS(data) {
|
|
@@ -993,9 +1184,9 @@ export class ScoredUrl {
|
|
|
993
1184
|
}
|
|
994
1185
|
toJSON(data) {
|
|
995
1186
|
data = typeof data === 'object' ? data : {};
|
|
996
|
-
data[
|
|
997
|
-
data[
|
|
998
|
-
data[
|
|
1187
|
+
data['url'] = this.url;
|
|
1188
|
+
data['score'] = this.score;
|
|
1189
|
+
data['title'] = this.title;
|
|
999
1190
|
return data;
|
|
1000
1191
|
}
|
|
1001
1192
|
}
|
|
@@ -1025,16 +1216,18 @@ export class Selections {
|
|
|
1025
1216
|
}
|
|
1026
1217
|
init(_data) {
|
|
1027
1218
|
if (_data) {
|
|
1028
|
-
if (Array.isArray(_data[
|
|
1219
|
+
if (Array.isArray(_data['values'])) {
|
|
1029
1220
|
this.values = [];
|
|
1030
|
-
for (let item of _data[
|
|
1221
|
+
for (let item of _data['values'])
|
|
1031
1222
|
this.values.push(item);
|
|
1032
1223
|
}
|
|
1033
|
-
if (_data[
|
|
1224
|
+
if (_data['subOptions']) {
|
|
1034
1225
|
this.subOptions = {};
|
|
1035
|
-
for (let key in _data[
|
|
1036
|
-
if (_data[
|
|
1037
|
-
this.subOptions[key] = _data[
|
|
1226
|
+
for (let key in _data['subOptions']) {
|
|
1227
|
+
if (_data['subOptions'].hasOwnProperty(key))
|
|
1228
|
+
this.subOptions[key] = _data['subOptions'][key]
|
|
1229
|
+
? Selections.fromJS(_data['subOptions'][key])
|
|
1230
|
+
: new Selections();
|
|
1038
1231
|
}
|
|
1039
1232
|
}
|
|
1040
1233
|
}
|
|
@@ -1048,15 +1241,17 @@ export class Selections {
|
|
|
1048
1241
|
toJSON(data) {
|
|
1049
1242
|
data = typeof data === 'object' ? data : {};
|
|
1050
1243
|
if (Array.isArray(this.values)) {
|
|
1051
|
-
data[
|
|
1244
|
+
data['values'] = [];
|
|
1052
1245
|
for (let item of this.values)
|
|
1053
|
-
data[
|
|
1246
|
+
data['values'].push(item);
|
|
1054
1247
|
}
|
|
1055
1248
|
if (this.subOptions) {
|
|
1056
|
-
data[
|
|
1249
|
+
data['subOptions'] = {};
|
|
1057
1250
|
for (let key in this.subOptions) {
|
|
1058
1251
|
if (this.subOptions.hasOwnProperty(key))
|
|
1059
|
-
data[
|
|
1252
|
+
data['subOptions'][key] = this.subOptions[key]
|
|
1253
|
+
? this.subOptions[key].toJSON()
|
|
1254
|
+
: undefined;
|
|
1060
1255
|
}
|
|
1061
1256
|
}
|
|
1062
1257
|
return data;
|
|
@@ -1088,12 +1283,12 @@ export class Session {
|
|
|
1088
1283
|
}
|
|
1089
1284
|
init(_data) {
|
|
1090
1285
|
if (_data) {
|
|
1091
|
-
this.id = _data[
|
|
1092
|
-
if (_data[
|
|
1286
|
+
this.id = _data['id'];
|
|
1287
|
+
if (_data['data']) {
|
|
1093
1288
|
this.data = {};
|
|
1094
|
-
for (let key in _data[
|
|
1095
|
-
if (_data[
|
|
1096
|
-
this.data[key] = _data[
|
|
1289
|
+
for (let key in _data['data']) {
|
|
1290
|
+
if (_data['data'].hasOwnProperty(key))
|
|
1291
|
+
this.data[key] = _data['data'][key];
|
|
1097
1292
|
}
|
|
1098
1293
|
}
|
|
1099
1294
|
}
|
|
@@ -1106,12 +1301,12 @@ export class Session {
|
|
|
1106
1301
|
}
|
|
1107
1302
|
toJSON(data) {
|
|
1108
1303
|
data = typeof data === 'object' ? data : {};
|
|
1109
|
-
data[
|
|
1304
|
+
data['id'] = this.id;
|
|
1110
1305
|
if (this.data) {
|
|
1111
|
-
data[
|
|
1306
|
+
data['data'] = {};
|
|
1112
1307
|
for (let key in this.data) {
|
|
1113
1308
|
if (this.data.hasOwnProperty(key))
|
|
1114
|
-
data[
|
|
1309
|
+
data['data'][key] = this.data[key];
|
|
1115
1310
|
}
|
|
1116
1311
|
}
|
|
1117
1312
|
return data;
|
|
@@ -1175,17 +1370,21 @@ export class UserMessage {
|
|
|
1175
1370
|
}
|
|
1176
1371
|
init(_data) {
|
|
1177
1372
|
if (_data) {
|
|
1178
|
-
this.id = _data[
|
|
1179
|
-
this.sessionId = _data[
|
|
1180
|
-
this.timeStamp = _data[
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
this.
|
|
1184
|
-
|
|
1373
|
+
this.id = _data['id'];
|
|
1374
|
+
this.sessionId = _data['sessionId'];
|
|
1375
|
+
this.timeStamp = _data['timeStamp']
|
|
1376
|
+
? new Date(_data['timeStamp'].toString())
|
|
1377
|
+
: undefined;
|
|
1378
|
+
this.question = _data['question'];
|
|
1379
|
+
this.experience = _data['experience'];
|
|
1380
|
+
this.selections = _data['selections']
|
|
1381
|
+
? Selections.fromJS(_data['selections'])
|
|
1382
|
+
: undefined;
|
|
1383
|
+
if (_data['context']) {
|
|
1185
1384
|
this.context = {};
|
|
1186
|
-
for (let key in _data[
|
|
1187
|
-
if (_data[
|
|
1188
|
-
this.context[key] = _data[
|
|
1385
|
+
for (let key in _data['context']) {
|
|
1386
|
+
if (_data['context'].hasOwnProperty(key))
|
|
1387
|
+
this.context[key] = _data['context'][key];
|
|
1189
1388
|
}
|
|
1190
1389
|
}
|
|
1191
1390
|
}
|
|
@@ -1198,17 +1397,17 @@ export class UserMessage {
|
|
|
1198
1397
|
}
|
|
1199
1398
|
toJSON(data) {
|
|
1200
1399
|
data = typeof data === 'object' ? data : {};
|
|
1201
|
-
data[
|
|
1202
|
-
data[
|
|
1203
|
-
data[
|
|
1204
|
-
data[
|
|
1205
|
-
data[
|
|
1206
|
-
data[
|
|
1400
|
+
data['id'] = this.id;
|
|
1401
|
+
data['sessionId'] = this.sessionId;
|
|
1402
|
+
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : undefined;
|
|
1403
|
+
data['question'] = this.question;
|
|
1404
|
+
data['experience'] = this.experience;
|
|
1405
|
+
data['selections'] = this.selections ? this.selections.toJSON() : undefined;
|
|
1207
1406
|
if (this.context) {
|
|
1208
|
-
data[
|
|
1407
|
+
data['context'] = {};
|
|
1209
1408
|
for (let key in this.context) {
|
|
1210
1409
|
if (this.context.hasOwnProperty(key))
|
|
1211
|
-
data[
|
|
1410
|
+
data['context'][key] = this.context[key];
|
|
1212
1411
|
}
|
|
1213
1412
|
}
|
|
1214
1413
|
return data;
|
|
@@ -1269,4 +1468,7 @@ function throwException(message, status, response, headers, result) {
|
|
|
1269
1468
|
else
|
|
1270
1469
|
throw new ApiException(message, status, response, headers, null);
|
|
1271
1470
|
}
|
|
1471
|
+
function isAxiosError(obj) {
|
|
1472
|
+
return obj && obj.isAxiosError === true;
|
|
1473
|
+
}
|
|
1272
1474
|
//# sourceMappingURL=native-client.js.map
|