@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
|
@@ -8,14 +8,23 @@
|
|
|
8
8
|
/* eslint-disable */
|
|
9
9
|
// ReSharper disable InconsistentNaming
|
|
10
10
|
|
|
11
|
+
import axios, {
|
|
12
|
+
AxiosError,
|
|
13
|
+
AxiosInstance,
|
|
14
|
+
AxiosRequestConfig,
|
|
15
|
+
AxiosResponse,
|
|
16
|
+
CancelToken,
|
|
17
|
+
} from 'axios';
|
|
18
|
+
|
|
11
19
|
export class Client {
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
protected instance: AxiosInstance;
|
|
21
|
+
protected baseUrl: string;
|
|
14
22
|
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
|
|
15
23
|
|
|
16
|
-
constructor(baseUrl?: string,
|
|
17
|
-
this.
|
|
18
|
-
|
|
24
|
+
constructor(baseUrl?: string, instance?: AxiosInstance) {
|
|
25
|
+
this.instance = instance || axios.create();
|
|
26
|
+
|
|
27
|
+
this.baseUrl = baseUrl ?? '';
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
/**
|
|
@@ -23,45 +32,71 @@ export class Client {
|
|
|
23
32
|
* @param body (optional)
|
|
24
33
|
* @return Success
|
|
25
34
|
*/
|
|
26
|
-
feedback(
|
|
27
|
-
|
|
35
|
+
feedback(
|
|
36
|
+
version: string,
|
|
37
|
+
x_Client_ID: any | undefined,
|
|
38
|
+
body: Feedback | undefined,
|
|
39
|
+
signal?: AbortSignal
|
|
40
|
+
): Promise<Feedback> {
|
|
41
|
+
let url_ = this.baseUrl + '/api/v{version}/feedback';
|
|
28
42
|
if (version === undefined || version === null)
|
|
29
43
|
throw new Error("The parameter 'version' must be defined.");
|
|
30
|
-
url_ = url_.replace(
|
|
31
|
-
url_ = url_.replace(/[?&]$/,
|
|
44
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
45
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
32
46
|
|
|
33
47
|
const content_ = JSON.stringify(body);
|
|
34
48
|
|
|
35
|
-
let options_:
|
|
36
|
-
|
|
37
|
-
method:
|
|
38
|
-
|
|
49
|
+
let options_: AxiosRequestConfig = {
|
|
50
|
+
data: content_,
|
|
51
|
+
method: 'POST',
|
|
52
|
+
url: url_,
|
|
39
53
|
headers: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
'X-Client-ID':
|
|
55
|
+
x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
56
|
+
'Content-Type': 'application/json',
|
|
57
|
+
'Accept': 'text/plain',
|
|
58
|
+
},
|
|
59
|
+
signal,
|
|
44
60
|
};
|
|
45
61
|
|
|
46
|
-
return this.
|
|
47
|
-
|
|
48
|
-
|
|
62
|
+
return this.instance
|
|
63
|
+
.request(options_)
|
|
64
|
+
.catch((_error: any) => {
|
|
65
|
+
if (isAxiosError(_error) && _error.response) {
|
|
66
|
+
return _error.response;
|
|
67
|
+
} else {
|
|
68
|
+
throw _error;
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
.then((_response: AxiosResponse) => {
|
|
72
|
+
return this.processFeedback(_response);
|
|
73
|
+
});
|
|
49
74
|
}
|
|
50
75
|
|
|
51
|
-
protected processFeedback(response:
|
|
76
|
+
protected processFeedback(response: AxiosResponse): Promise<Feedback> {
|
|
52
77
|
const status = response.status;
|
|
53
|
-
let _headers: any = {};
|
|
78
|
+
let _headers: any = {};
|
|
79
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
80
|
+
for (const k in response.headers) {
|
|
81
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
82
|
+
_headers[k] = response.headers[k];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
54
86
|
if (status === 200) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
87
|
+
const _responseText = response.data;
|
|
88
|
+
let result200: any = null;
|
|
89
|
+
let resultData200 = _responseText;
|
|
90
|
+
result200 = Feedback.fromJS(resultData200);
|
|
91
|
+
return Promise.resolve<Feedback>(result200);
|
|
61
92
|
} else if (status !== 200 && status !== 204) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
93
|
+
const _responseText = response.data;
|
|
94
|
+
return throwException(
|
|
95
|
+
'An unexpected server error occurred.',
|
|
96
|
+
status,
|
|
97
|
+
_responseText,
|
|
98
|
+
_headers
|
|
99
|
+
);
|
|
65
100
|
}
|
|
66
101
|
return Promise.resolve<Feedback>(null as any);
|
|
67
102
|
}
|
|
@@ -71,100 +106,231 @@ export class Client {
|
|
|
71
106
|
* @param body (optional)
|
|
72
107
|
* @return Success
|
|
73
108
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
109
|
+
followUpEmail(
|
|
110
|
+
version: string,
|
|
111
|
+
x_Client_ID: any | undefined,
|
|
112
|
+
body: UserMessage | undefined,
|
|
113
|
+
signal?: AbortSignal
|
|
114
|
+
): Promise<BotMessage> {
|
|
115
|
+
let url_ = this.baseUrl + '/api/v{version}/follow-up-email';
|
|
76
116
|
if (version === undefined || version === null)
|
|
77
117
|
throw new Error("The parameter 'version' must be defined.");
|
|
78
|
-
url_ = url_.replace(
|
|
79
|
-
url_ = url_.replace(/[?&]$/,
|
|
118
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
119
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
80
120
|
|
|
81
121
|
const content_ = JSON.stringify(body);
|
|
82
122
|
|
|
83
|
-
let options_:
|
|
84
|
-
|
|
85
|
-
method:
|
|
86
|
-
|
|
123
|
+
let options_: AxiosRequestConfig = {
|
|
124
|
+
data: content_,
|
|
125
|
+
method: 'POST',
|
|
126
|
+
url: url_,
|
|
87
127
|
headers: {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
128
|
+
'X-Client-ID':
|
|
129
|
+
x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
130
|
+
'Content-Type': 'application/json',
|
|
131
|
+
'Accept': 'text/plain',
|
|
132
|
+
},
|
|
133
|
+
signal,
|
|
92
134
|
};
|
|
93
135
|
|
|
94
|
-
return this.
|
|
95
|
-
|
|
96
|
-
|
|
136
|
+
return this.instance
|
|
137
|
+
.request(options_)
|
|
138
|
+
.catch((_error: any) => {
|
|
139
|
+
if (isAxiosError(_error) && _error.response) {
|
|
140
|
+
return _error.response;
|
|
141
|
+
} else {
|
|
142
|
+
throw _error;
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
.then((_response: AxiosResponse) => {
|
|
146
|
+
return this.processFollowUpEmail(_response);
|
|
147
|
+
});
|
|
97
148
|
}
|
|
98
149
|
|
|
99
|
-
protected
|
|
150
|
+
protected processFollowUpEmail(response: AxiosResponse): Promise<BotMessage> {
|
|
100
151
|
const status = response.status;
|
|
101
|
-
let _headers: any = {};
|
|
152
|
+
let _headers: any = {};
|
|
153
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
154
|
+
for (const k in response.headers) {
|
|
155
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
156
|
+
_headers[k] = response.headers[k];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
102
160
|
if (status === 200) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
});
|
|
161
|
+
const _responseText = response.data;
|
|
162
|
+
let result200: any = null;
|
|
163
|
+
let resultData200 = _responseText;
|
|
164
|
+
result200 = BotMessage.fromJS(resultData200);
|
|
165
|
+
return Promise.resolve<BotMessage>(result200);
|
|
109
166
|
} else if (status === 500) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
167
|
+
const _responseText = response.data;
|
|
168
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
113
169
|
} else if (status === 502) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
});
|
|
170
|
+
const _responseText = response.data;
|
|
171
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
117
172
|
} else if (status === 504) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
173
|
+
const _responseText = response.data;
|
|
174
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
121
175
|
} else if (status !== 200 && status !== 204) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
176
|
+
const _responseText = response.data;
|
|
177
|
+
return throwException(
|
|
178
|
+
'An unexpected server error occurred.',
|
|
179
|
+
status,
|
|
180
|
+
_responseText,
|
|
181
|
+
_headers
|
|
182
|
+
);
|
|
125
183
|
}
|
|
126
184
|
return Promise.resolve<BotMessage>(null as any);
|
|
127
185
|
}
|
|
128
186
|
|
|
129
187
|
/**
|
|
130
188
|
* @param x_Client_ID (optional)
|
|
189
|
+
* @param body (optional)
|
|
131
190
|
* @return Success
|
|
132
191
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
192
|
+
message(
|
|
193
|
+
version: string,
|
|
194
|
+
x_Client_ID: any | undefined,
|
|
195
|
+
body: UserMessage | undefined,
|
|
196
|
+
signal?: AbortSignal
|
|
197
|
+
): Promise<BotMessage> {
|
|
198
|
+
let url_ = this.baseUrl + '/api/v{version}/message';
|
|
135
199
|
if (version === undefined || version === null)
|
|
136
200
|
throw new Error("The parameter 'version' must be defined.");
|
|
137
|
-
url_ = url_.replace(
|
|
138
|
-
url_ = url_.replace(/[?&]$/,
|
|
201
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
202
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
139
203
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
204
|
+
const content_ = JSON.stringify(body);
|
|
205
|
+
|
|
206
|
+
let options_: AxiosRequestConfig = {
|
|
207
|
+
data: content_,
|
|
208
|
+
method: 'POST',
|
|
209
|
+
url: url_,
|
|
143
210
|
headers: {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
211
|
+
'X-Client-ID':
|
|
212
|
+
x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
213
|
+
'Content-Type': 'application/json',
|
|
214
|
+
'Accept': 'text/plain',
|
|
215
|
+
},
|
|
216
|
+
signal,
|
|
147
217
|
};
|
|
148
218
|
|
|
149
|
-
return this.
|
|
150
|
-
|
|
151
|
-
|
|
219
|
+
return this.instance
|
|
220
|
+
.request(options_)
|
|
221
|
+
.catch((_error: any) => {
|
|
222
|
+
if (isAxiosError(_error) && _error.response) {
|
|
223
|
+
return _error.response;
|
|
224
|
+
} else {
|
|
225
|
+
throw _error;
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
.then((_response: AxiosResponse) => {
|
|
229
|
+
return this.processMessage(_response);
|
|
230
|
+
});
|
|
152
231
|
}
|
|
153
232
|
|
|
154
|
-
protected
|
|
233
|
+
protected processMessage(response: AxiosResponse): Promise<BotMessage> {
|
|
155
234
|
const status = response.status;
|
|
156
|
-
let _headers: any = {};
|
|
235
|
+
let _headers: any = {};
|
|
236
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
237
|
+
for (const k in response.headers) {
|
|
238
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
239
|
+
_headers[k] = response.headers[k];
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
157
243
|
if (status === 200) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
244
|
+
const _responseText = response.data;
|
|
245
|
+
let result200: any = null;
|
|
246
|
+
let resultData200 = _responseText;
|
|
247
|
+
result200 = BotMessage.fromJS(resultData200);
|
|
248
|
+
return Promise.resolve<BotMessage>(result200);
|
|
249
|
+
} else if (status === 500) {
|
|
250
|
+
const _responseText = response.data;
|
|
251
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
252
|
+
} else if (status === 502) {
|
|
253
|
+
const _responseText = response.data;
|
|
254
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
255
|
+
} else if (status === 504) {
|
|
256
|
+
const _responseText = response.data;
|
|
257
|
+
return throwException('Server Error', status, _responseText, _headers);
|
|
164
258
|
} else if (status !== 200 && status !== 204) {
|
|
165
|
-
|
|
166
|
-
|
|
259
|
+
const _responseText = response.data;
|
|
260
|
+
return throwException(
|
|
261
|
+
'An unexpected server error occurred.',
|
|
262
|
+
status,
|
|
263
|
+
_responseText,
|
|
264
|
+
_headers
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
return Promise.resolve<BotMessage>(null as any);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @param x_Client_ID (optional)
|
|
272
|
+
* @return Success
|
|
273
|
+
*/
|
|
274
|
+
options(
|
|
275
|
+
version: string,
|
|
276
|
+
x_Client_ID: any | undefined,
|
|
277
|
+
signal?: AbortSignal
|
|
278
|
+
): Promise<FrontendModel> {
|
|
279
|
+
let url_ = this.baseUrl + '/api/v{version}/options';
|
|
280
|
+
if (version === undefined || version === null)
|
|
281
|
+
throw new Error("The parameter 'version' must be defined.");
|
|
282
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
283
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
284
|
+
|
|
285
|
+
let options_: AxiosRequestConfig = {
|
|
286
|
+
method: 'GET',
|
|
287
|
+
url: url_,
|
|
288
|
+
headers: {
|
|
289
|
+
'X-Client-ID':
|
|
290
|
+
x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
291
|
+
'Accept': 'text/plain',
|
|
292
|
+
},
|
|
293
|
+
signal,
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
return this.instance
|
|
297
|
+
.request(options_)
|
|
298
|
+
.catch((_error: any) => {
|
|
299
|
+
if (isAxiosError(_error) && _error.response) {
|
|
300
|
+
return _error.response;
|
|
301
|
+
} else {
|
|
302
|
+
throw _error;
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
.then((_response: AxiosResponse) => {
|
|
306
|
+
return this.processOptions(_response);
|
|
167
307
|
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
protected processOptions(response: AxiosResponse): Promise<FrontendModel> {
|
|
311
|
+
const status = response.status;
|
|
312
|
+
let _headers: any = {};
|
|
313
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
314
|
+
for (const k in response.headers) {
|
|
315
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
316
|
+
_headers[k] = response.headers[k];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (status === 200) {
|
|
321
|
+
const _responseText = response.data;
|
|
322
|
+
let result200: any = null;
|
|
323
|
+
let resultData200 = _responseText;
|
|
324
|
+
result200 = FrontendModel.fromJS(resultData200);
|
|
325
|
+
return Promise.resolve<FrontendModel>(result200);
|
|
326
|
+
} else if (status !== 200 && status !== 204) {
|
|
327
|
+
const _responseText = response.data;
|
|
328
|
+
return throwException(
|
|
329
|
+
'An unexpected server error occurred.',
|
|
330
|
+
status,
|
|
331
|
+
_responseText,
|
|
332
|
+
_headers
|
|
333
|
+
);
|
|
168
334
|
}
|
|
169
335
|
return Promise.resolve<FrontendModel>(null as any);
|
|
170
336
|
}
|
|
@@ -174,45 +340,71 @@ export class Client {
|
|
|
174
340
|
* @param body (optional)
|
|
175
341
|
* @return Success
|
|
176
342
|
*/
|
|
177
|
-
sessionPOST(
|
|
178
|
-
|
|
343
|
+
sessionPOST(
|
|
344
|
+
version: string,
|
|
345
|
+
x_Client_ID: any | undefined,
|
|
346
|
+
body: Session | undefined,
|
|
347
|
+
signal?: AbortSignal
|
|
348
|
+
): Promise<Session> {
|
|
349
|
+
let url_ = this.baseUrl + '/api/v{version}/session';
|
|
179
350
|
if (version === undefined || version === null)
|
|
180
351
|
throw new Error("The parameter 'version' must be defined.");
|
|
181
|
-
url_ = url_.replace(
|
|
182
|
-
url_ = url_.replace(/[?&]$/,
|
|
352
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
353
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
183
354
|
|
|
184
355
|
const content_ = JSON.stringify(body);
|
|
185
356
|
|
|
186
|
-
let options_:
|
|
187
|
-
|
|
188
|
-
method:
|
|
189
|
-
|
|
357
|
+
let options_: AxiosRequestConfig = {
|
|
358
|
+
data: content_,
|
|
359
|
+
method: 'POST',
|
|
360
|
+
url: url_,
|
|
190
361
|
headers: {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
362
|
+
'X-Client-ID':
|
|
363
|
+
x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
364
|
+
'Content-Type': 'application/json',
|
|
365
|
+
'Accept': 'text/plain',
|
|
366
|
+
},
|
|
367
|
+
signal,
|
|
195
368
|
};
|
|
196
369
|
|
|
197
|
-
return this.
|
|
198
|
-
|
|
199
|
-
|
|
370
|
+
return this.instance
|
|
371
|
+
.request(options_)
|
|
372
|
+
.catch((_error: any) => {
|
|
373
|
+
if (isAxiosError(_error) && _error.response) {
|
|
374
|
+
return _error.response;
|
|
375
|
+
} else {
|
|
376
|
+
throw _error;
|
|
377
|
+
}
|
|
378
|
+
})
|
|
379
|
+
.then((_response: AxiosResponse) => {
|
|
380
|
+
return this.processSessionPOST(_response);
|
|
381
|
+
});
|
|
200
382
|
}
|
|
201
383
|
|
|
202
|
-
protected processSessionPOST(response:
|
|
384
|
+
protected processSessionPOST(response: AxiosResponse): Promise<Session> {
|
|
203
385
|
const status = response.status;
|
|
204
|
-
let _headers: any = {};
|
|
386
|
+
let _headers: any = {};
|
|
387
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
388
|
+
for (const k in response.headers) {
|
|
389
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
390
|
+
_headers[k] = response.headers[k];
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
205
394
|
if (status === 200) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
});
|
|
395
|
+
const _responseText = response.data;
|
|
396
|
+
let result200: any = null;
|
|
397
|
+
let resultData200 = _responseText;
|
|
398
|
+
result200 = Session.fromJS(resultData200);
|
|
399
|
+
return Promise.resolve<Session>(result200);
|
|
212
400
|
} else if (status !== 200 && status !== 204) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
401
|
+
const _responseText = response.data;
|
|
402
|
+
return throwException(
|
|
403
|
+
'An unexpected server error occurred.',
|
|
404
|
+
status,
|
|
405
|
+
_responseText,
|
|
406
|
+
_headers
|
|
407
|
+
);
|
|
216
408
|
}
|
|
217
409
|
return Promise.resolve<Session>(null as any);
|
|
218
410
|
}
|
|
@@ -222,45 +414,71 @@ export class Client {
|
|
|
222
414
|
* @param body (optional)
|
|
223
415
|
* @return Success
|
|
224
416
|
*/
|
|
225
|
-
sessionPATCH(
|
|
226
|
-
|
|
417
|
+
sessionPATCH(
|
|
418
|
+
version: string,
|
|
419
|
+
x_Client_ID: any | undefined,
|
|
420
|
+
body: Session | undefined,
|
|
421
|
+
signal?: AbortSignal
|
|
422
|
+
): Promise<Session> {
|
|
423
|
+
let url_ = this.baseUrl + '/api/v{version}/session';
|
|
227
424
|
if (version === undefined || version === null)
|
|
228
425
|
throw new Error("The parameter 'version' must be defined.");
|
|
229
|
-
url_ = url_.replace(
|
|
230
|
-
url_ = url_.replace(/[?&]$/,
|
|
426
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
427
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
231
428
|
|
|
232
429
|
const content_ = JSON.stringify(body);
|
|
233
430
|
|
|
234
|
-
let options_:
|
|
235
|
-
|
|
236
|
-
method:
|
|
237
|
-
|
|
431
|
+
let options_: AxiosRequestConfig = {
|
|
432
|
+
data: content_,
|
|
433
|
+
method: 'PATCH',
|
|
434
|
+
url: url_,
|
|
238
435
|
headers: {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
436
|
+
'X-Client-ID':
|
|
437
|
+
x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
438
|
+
'Content-Type': 'application/json',
|
|
439
|
+
'Accept': 'text/plain',
|
|
440
|
+
},
|
|
441
|
+
signal,
|
|
243
442
|
};
|
|
244
443
|
|
|
245
|
-
return this.
|
|
246
|
-
|
|
247
|
-
|
|
444
|
+
return this.instance
|
|
445
|
+
.request(options_)
|
|
446
|
+
.catch((_error: any) => {
|
|
447
|
+
if (isAxiosError(_error) && _error.response) {
|
|
448
|
+
return _error.response;
|
|
449
|
+
} else {
|
|
450
|
+
throw _error;
|
|
451
|
+
}
|
|
452
|
+
})
|
|
453
|
+
.then((_response: AxiosResponse) => {
|
|
454
|
+
return this.processSessionPATCH(_response);
|
|
455
|
+
});
|
|
248
456
|
}
|
|
249
457
|
|
|
250
|
-
protected processSessionPATCH(response:
|
|
458
|
+
protected processSessionPATCH(response: AxiosResponse): Promise<Session> {
|
|
251
459
|
const status = response.status;
|
|
252
|
-
let _headers: any = {};
|
|
460
|
+
let _headers: any = {};
|
|
461
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
462
|
+
for (const k in response.headers) {
|
|
463
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
464
|
+
_headers[k] = response.headers[k];
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
253
468
|
if (status === 200) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
});
|
|
469
|
+
const _responseText = response.data;
|
|
470
|
+
let result200: any = null;
|
|
471
|
+
let resultData200 = _responseText;
|
|
472
|
+
result200 = Session.fromJS(resultData200);
|
|
473
|
+
return Promise.resolve<Session>(result200);
|
|
260
474
|
} else if (status !== 200 && status !== 204) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
475
|
+
const _responseText = response.data;
|
|
476
|
+
return throwException(
|
|
477
|
+
'An unexpected server error occurred.',
|
|
478
|
+
status,
|
|
479
|
+
_responseText,
|
|
480
|
+
_headers
|
|
481
|
+
);
|
|
264
482
|
}
|
|
265
483
|
return Promise.resolve<Session>(null as any);
|
|
266
484
|
}
|
|
@@ -270,45 +488,71 @@ export class Client {
|
|
|
270
488
|
* @param body (optional)
|
|
271
489
|
* @return Success
|
|
272
490
|
*/
|
|
273
|
-
sessionDELETE(
|
|
274
|
-
|
|
491
|
+
sessionDELETE(
|
|
492
|
+
version: string,
|
|
493
|
+
x_Client_ID: any | undefined,
|
|
494
|
+
body: Session | undefined,
|
|
495
|
+
signal?: AbortSignal
|
|
496
|
+
): Promise<Session> {
|
|
497
|
+
let url_ = this.baseUrl + '/api/v{version}/session';
|
|
275
498
|
if (version === undefined || version === null)
|
|
276
499
|
throw new Error("The parameter 'version' must be defined.");
|
|
277
|
-
url_ = url_.replace(
|
|
278
|
-
url_ = url_.replace(/[?&]$/,
|
|
500
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
501
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
279
502
|
|
|
280
503
|
const content_ = JSON.stringify(body);
|
|
281
504
|
|
|
282
|
-
let options_:
|
|
283
|
-
|
|
284
|
-
method:
|
|
285
|
-
|
|
505
|
+
let options_: AxiosRequestConfig = {
|
|
506
|
+
data: content_,
|
|
507
|
+
method: 'DELETE',
|
|
508
|
+
url: url_,
|
|
286
509
|
headers: {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
510
|
+
'X-Client-ID':
|
|
511
|
+
x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
512
|
+
'Content-Type': 'application/json',
|
|
513
|
+
'Accept': 'text/plain',
|
|
514
|
+
},
|
|
515
|
+
signal,
|
|
291
516
|
};
|
|
292
517
|
|
|
293
|
-
return this.
|
|
294
|
-
|
|
295
|
-
|
|
518
|
+
return this.instance
|
|
519
|
+
.request(options_)
|
|
520
|
+
.catch((_error: any) => {
|
|
521
|
+
if (isAxiosError(_error) && _error.response) {
|
|
522
|
+
return _error.response;
|
|
523
|
+
} else {
|
|
524
|
+
throw _error;
|
|
525
|
+
}
|
|
526
|
+
})
|
|
527
|
+
.then((_response: AxiosResponse) => {
|
|
528
|
+
return this.processSessionDELETE(_response);
|
|
529
|
+
});
|
|
296
530
|
}
|
|
297
531
|
|
|
298
|
-
protected processSessionDELETE(response:
|
|
532
|
+
protected processSessionDELETE(response: AxiosResponse): Promise<Session> {
|
|
299
533
|
const status = response.status;
|
|
300
|
-
let _headers: any = {};
|
|
534
|
+
let _headers: any = {};
|
|
535
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
536
|
+
for (const k in response.headers) {
|
|
537
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
538
|
+
_headers[k] = response.headers[k];
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
301
542
|
if (status === 200) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
});
|
|
543
|
+
const _responseText = response.data;
|
|
544
|
+
let result200: any = null;
|
|
545
|
+
let resultData200 = _responseText;
|
|
546
|
+
result200 = Session.fromJS(resultData200);
|
|
547
|
+
return Promise.resolve<Session>(result200);
|
|
308
548
|
} else if (status !== 200 && status !== 204) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
549
|
+
const _responseText = response.data;
|
|
550
|
+
return throwException(
|
|
551
|
+
'An unexpected server error occurred.',
|
|
552
|
+
status,
|
|
553
|
+
_responseText,
|
|
554
|
+
_headers
|
|
555
|
+
);
|
|
312
556
|
}
|
|
313
557
|
return Promise.resolve<Session>(null as any);
|
|
314
558
|
}
|
|
@@ -319,56 +563,79 @@ export class Client {
|
|
|
319
563
|
* @param x_Client_ID (optional)
|
|
320
564
|
* @return Success
|
|
321
565
|
*/
|
|
322
|
-
transcripts(
|
|
323
|
-
|
|
566
|
+
transcripts(
|
|
567
|
+
start: Date | undefined,
|
|
568
|
+
end: Date | undefined,
|
|
569
|
+
version: string,
|
|
570
|
+
x_Client_ID: any | undefined,
|
|
571
|
+
signal?: AbortSignal
|
|
572
|
+
): Promise<ExportHistoryMessage[]> {
|
|
573
|
+
let url_ = this.baseUrl + '/api/v{version}/transcripts?';
|
|
324
574
|
if (version === undefined || version === null)
|
|
325
575
|
throw new Error("The parameter 'version' must be defined.");
|
|
326
|
-
url_ = url_.replace(
|
|
327
|
-
if (start === null)
|
|
328
|
-
throw new Error("The parameter 'start' cannot be null.");
|
|
576
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
577
|
+
if (start === null) throw new Error("The parameter 'start' cannot be null.");
|
|
329
578
|
else if (start !== undefined)
|
|
330
|
-
url_ +=
|
|
331
|
-
if (end === null)
|
|
332
|
-
throw new Error("The parameter 'end' cannot be null.");
|
|
579
|
+
url_ += 'start=' + encodeURIComponent(start ? '' + start.toISOString() : '') + '&';
|
|
580
|
+
if (end === null) throw new Error("The parameter 'end' cannot be null.");
|
|
333
581
|
else if (end !== undefined)
|
|
334
|
-
url_ +=
|
|
335
|
-
url_ = url_.replace(/[?&]$/,
|
|
582
|
+
url_ += 'end=' + encodeURIComponent(end ? '' + end.toISOString() : '') + '&';
|
|
583
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
336
584
|
|
|
337
|
-
let options_:
|
|
338
|
-
method:
|
|
339
|
-
|
|
585
|
+
let options_: AxiosRequestConfig = {
|
|
586
|
+
method: 'GET',
|
|
587
|
+
url: url_,
|
|
340
588
|
headers: {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
589
|
+
'X-Client-ID':
|
|
590
|
+
x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
591
|
+
'Accept': 'text/plain',
|
|
592
|
+
},
|
|
593
|
+
signal,
|
|
344
594
|
};
|
|
345
595
|
|
|
346
|
-
return this.
|
|
347
|
-
|
|
348
|
-
|
|
596
|
+
return this.instance
|
|
597
|
+
.request(options_)
|
|
598
|
+
.catch((_error: any) => {
|
|
599
|
+
if (isAxiosError(_error) && _error.response) {
|
|
600
|
+
return _error.response;
|
|
601
|
+
} else {
|
|
602
|
+
throw _error;
|
|
603
|
+
}
|
|
604
|
+
})
|
|
605
|
+
.then((_response: AxiosResponse) => {
|
|
606
|
+
return this.processTranscripts(_response);
|
|
607
|
+
});
|
|
349
608
|
}
|
|
350
609
|
|
|
351
|
-
protected processTranscripts(response:
|
|
610
|
+
protected processTranscripts(response: AxiosResponse): Promise<ExportHistoryMessage[]> {
|
|
352
611
|
const status = response.status;
|
|
353
|
-
let _headers: any = {};
|
|
354
|
-
if (
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
if (Array.isArray(resultData200)) {
|
|
359
|
-
result200 = [] as any;
|
|
360
|
-
for (let item of resultData200)
|
|
361
|
-
result200!.push(ExportHistoryMessage.fromJS(item));
|
|
612
|
+
let _headers: any = {};
|
|
613
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
614
|
+
for (const k in response.headers) {
|
|
615
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
616
|
+
_headers[k] = response.headers[k];
|
|
362
617
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (status === 200) {
|
|
621
|
+
const _responseText = response.data;
|
|
622
|
+
let result200: any = null;
|
|
623
|
+
let resultData200 = _responseText;
|
|
624
|
+
if (Array.isArray(resultData200)) {
|
|
625
|
+
result200 = [] as any;
|
|
626
|
+
for (let item of resultData200) result200!.push(ExportHistoryMessage.fromJS(item));
|
|
627
|
+
} else {
|
|
628
|
+
result200 = <any>null;
|
|
629
|
+
}
|
|
630
|
+
return Promise.resolve<ExportHistoryMessage[]>(result200);
|
|
368
631
|
} else if (status !== 200 && status !== 204) {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
632
|
+
const _responseText = response.data;
|
|
633
|
+
return throwException(
|
|
634
|
+
'An unexpected server error occurred.',
|
|
635
|
+
status,
|
|
636
|
+
_responseText,
|
|
637
|
+
_headers
|
|
638
|
+
);
|
|
372
639
|
}
|
|
373
640
|
return Promise.resolve<ExportHistoryMessage[]>(null as any);
|
|
374
641
|
}
|
|
@@ -378,46 +645,71 @@ export class Client {
|
|
|
378
645
|
* @param x_Client_ID (optional)
|
|
379
646
|
* @return Success
|
|
380
647
|
*/
|
|
381
|
-
summary(
|
|
382
|
-
|
|
648
|
+
summary(
|
|
649
|
+
sessionId: number | undefined,
|
|
650
|
+
version: string,
|
|
651
|
+
x_Client_ID: any | undefined,
|
|
652
|
+
signal?: AbortSignal
|
|
653
|
+
): Promise<string> {
|
|
654
|
+
let url_ = this.baseUrl + '/api/v{version}/transcripts/summary?';
|
|
383
655
|
if (version === undefined || version === null)
|
|
384
656
|
throw new Error("The parameter 'version' must be defined.");
|
|
385
|
-
url_ = url_.replace(
|
|
386
|
-
if (sessionId === null)
|
|
387
|
-
throw new Error("The parameter 'sessionId' cannot be null.");
|
|
657
|
+
url_ = url_.replace('{version}', encodeURIComponent('' + version));
|
|
658
|
+
if (sessionId === null) throw new Error("The parameter 'sessionId' cannot be null.");
|
|
388
659
|
else if (sessionId !== undefined)
|
|
389
|
-
url_ +=
|
|
390
|
-
url_ = url_.replace(/[?&]$/,
|
|
660
|
+
url_ += 'sessionId=' + encodeURIComponent('' + sessionId) + '&';
|
|
661
|
+
url_ = url_.replace(/[?&]$/, '');
|
|
391
662
|
|
|
392
|
-
let options_:
|
|
393
|
-
method:
|
|
394
|
-
|
|
663
|
+
let options_: AxiosRequestConfig = {
|
|
664
|
+
method: 'GET',
|
|
665
|
+
url: url_,
|
|
395
666
|
headers: {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
667
|
+
'X-Client-ID':
|
|
668
|
+
x_Client_ID !== undefined && x_Client_ID !== null ? '' + x_Client_ID : '',
|
|
669
|
+
'Accept': 'text/plain',
|
|
670
|
+
},
|
|
671
|
+
signal,
|
|
399
672
|
};
|
|
400
673
|
|
|
401
|
-
return this.
|
|
402
|
-
|
|
403
|
-
|
|
674
|
+
return this.instance
|
|
675
|
+
.request(options_)
|
|
676
|
+
.catch((_error: any) => {
|
|
677
|
+
if (isAxiosError(_error) && _error.response) {
|
|
678
|
+
return _error.response;
|
|
679
|
+
} else {
|
|
680
|
+
throw _error;
|
|
681
|
+
}
|
|
682
|
+
})
|
|
683
|
+
.then((_response: AxiosResponse) => {
|
|
684
|
+
return this.processSummary(_response);
|
|
685
|
+
});
|
|
404
686
|
}
|
|
405
687
|
|
|
406
|
-
protected processSummary(response:
|
|
688
|
+
protected processSummary(response: AxiosResponse): Promise<string> {
|
|
407
689
|
const status = response.status;
|
|
408
|
-
let _headers: any = {};
|
|
690
|
+
let _headers: any = {};
|
|
691
|
+
if (response.headers && typeof response.headers === 'object') {
|
|
692
|
+
for (const k in response.headers) {
|
|
693
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
694
|
+
_headers[k] = response.headers[k];
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
409
698
|
if (status === 200) {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
699
|
+
const _responseText = response.data;
|
|
700
|
+
let result200: any = null;
|
|
701
|
+
let resultData200 = _responseText;
|
|
702
|
+
result200 = resultData200 !== undefined ? resultData200 : <any>null;
|
|
414
703
|
|
|
415
|
-
|
|
416
|
-
});
|
|
704
|
+
return Promise.resolve<string>(result200);
|
|
417
705
|
} else if (status !== 200 && status !== 204) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
706
|
+
const _responseText = response.data;
|
|
707
|
+
return throwException(
|
|
708
|
+
'An unexpected server error occurred.',
|
|
709
|
+
status,
|
|
710
|
+
_responseText,
|
|
711
|
+
_headers
|
|
712
|
+
);
|
|
421
713
|
}
|
|
422
714
|
return Promise.resolve<string>(null as any);
|
|
423
715
|
}
|
|
@@ -449,32 +741,35 @@ export class BotMessage implements IBotMessage {
|
|
|
449
741
|
modelVersion?: string | undefined;
|
|
450
742
|
/** Various metadata for diagnostics purposes. */
|
|
451
743
|
meta?: any | undefined;
|
|
744
|
+
/** How confident is the chatbot in its response. */
|
|
745
|
+
confidenceScore?: number | undefined;
|
|
452
746
|
|
|
453
747
|
constructor(data?: IBotMessage) {
|
|
454
748
|
if (data) {
|
|
455
749
|
for (var property in data) {
|
|
456
|
-
if (data.hasOwnProperty(property))
|
|
457
|
-
(<any>this)[property] = (<any>data)[property];
|
|
750
|
+
if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property];
|
|
458
751
|
}
|
|
459
752
|
}
|
|
460
753
|
}
|
|
461
754
|
|
|
462
755
|
init(_data?: any) {
|
|
463
756
|
if (_data) {
|
|
464
|
-
this.id = _data[
|
|
465
|
-
this.sessionId = _data[
|
|
466
|
-
this.timeStamp = _data[
|
|
467
|
-
|
|
468
|
-
|
|
757
|
+
this.id = _data['id'];
|
|
758
|
+
this.sessionId = _data['sessionId'];
|
|
759
|
+
this.timeStamp = _data['timeStamp']
|
|
760
|
+
? new Date(_data['timeStamp'].toString())
|
|
761
|
+
: <any>undefined;
|
|
762
|
+
this.answer = _data['answer'];
|
|
763
|
+
if (Array.isArray(_data['scoredUrls'])) {
|
|
469
764
|
this.scoredUrls = [] as any;
|
|
470
|
-
for (let item of _data[
|
|
471
|
-
this.scoredUrls!.push(ScoredUrl.fromJS(item));
|
|
765
|
+
for (let item of _data['scoredUrls']) this.scoredUrls!.push(ScoredUrl.fromJS(item));
|
|
472
766
|
}
|
|
473
|
-
this.guardFlag = _data[
|
|
474
|
-
this.isGuardrailed = _data[
|
|
475
|
-
this.botVersion = _data[
|
|
476
|
-
this.modelVersion = _data[
|
|
477
|
-
this.meta = _data[
|
|
767
|
+
this.guardFlag = _data['guardFlag'];
|
|
768
|
+
this.isGuardrailed = _data['isGuardrailed'];
|
|
769
|
+
this.botVersion = _data['botVersion'];
|
|
770
|
+
this.modelVersion = _data['modelVersion'];
|
|
771
|
+
this.meta = _data['meta'];
|
|
772
|
+
this.confidenceScore = _data['confidenceScore'];
|
|
478
773
|
}
|
|
479
774
|
}
|
|
480
775
|
|
|
@@ -487,20 +782,20 @@ export class BotMessage implements IBotMessage {
|
|
|
487
782
|
|
|
488
783
|
toJSON(data?: any) {
|
|
489
784
|
data = typeof data === 'object' ? data : {};
|
|
490
|
-
data[
|
|
491
|
-
data[
|
|
492
|
-
data[
|
|
493
|
-
data[
|
|
785
|
+
data['id'] = this.id;
|
|
786
|
+
data['sessionId'] = this.sessionId;
|
|
787
|
+
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : <any>undefined;
|
|
788
|
+
data['answer'] = this.answer;
|
|
494
789
|
if (Array.isArray(this.scoredUrls)) {
|
|
495
|
-
data[
|
|
496
|
-
for (let item of this.scoredUrls)
|
|
497
|
-
data["scoredUrls"].push(item.toJSON());
|
|
790
|
+
data['scoredUrls'] = [];
|
|
791
|
+
for (let item of this.scoredUrls) data['scoredUrls'].push(item.toJSON());
|
|
498
792
|
}
|
|
499
|
-
data[
|
|
500
|
-
data[
|
|
501
|
-
data[
|
|
502
|
-
data[
|
|
503
|
-
data[
|
|
793
|
+
data['guardFlag'] = this.guardFlag;
|
|
794
|
+
data['isGuardrailed'] = this.isGuardrailed;
|
|
795
|
+
data['botVersion'] = this.botVersion;
|
|
796
|
+
data['modelVersion'] = this.modelVersion;
|
|
797
|
+
data['meta'] = this.meta;
|
|
798
|
+
data['confidenceScore'] = this.confidenceScore;
|
|
504
799
|
return data;
|
|
505
800
|
}
|
|
506
801
|
}
|
|
@@ -531,6 +826,8 @@ export interface IBotMessage {
|
|
|
531
826
|
modelVersion?: string | undefined;
|
|
532
827
|
/** Various metadata for diagnostics purposes. */
|
|
533
828
|
meta?: any | undefined;
|
|
829
|
+
/** How confident is the chatbot in its response. */
|
|
830
|
+
confidenceScore?: number | undefined;
|
|
534
831
|
}
|
|
535
832
|
|
|
536
833
|
export enum Experience {
|
|
@@ -563,32 +860,39 @@ export class ExportHistoryMessage implements IExportHistoryMessage {
|
|
|
563
860
|
constructor(data?: IExportHistoryMessage) {
|
|
564
861
|
if (data) {
|
|
565
862
|
for (var property in data) {
|
|
566
|
-
if (data.hasOwnProperty(property))
|
|
567
|
-
(<any>this)[property] = (<any>data)[property];
|
|
863
|
+
if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property];
|
|
568
864
|
}
|
|
569
865
|
}
|
|
570
866
|
}
|
|
571
867
|
|
|
572
868
|
init(_data?: any) {
|
|
573
869
|
if (_data) {
|
|
574
|
-
this.id = _data[
|
|
575
|
-
this.sessionId = _data[
|
|
576
|
-
this.timeStamp = _data[
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
this.
|
|
580
|
-
this.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
this.
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
this.
|
|
587
|
-
this.
|
|
588
|
-
this.
|
|
589
|
-
this.
|
|
590
|
-
this.
|
|
591
|
-
this.
|
|
870
|
+
this.id = _data['id'];
|
|
871
|
+
this.sessionId = _data['sessionId'];
|
|
872
|
+
this.timeStamp = _data['timeStamp']
|
|
873
|
+
? new Date(_data['timeStamp'].toString())
|
|
874
|
+
: <any>undefined;
|
|
875
|
+
this.userId = _data['userId'];
|
|
876
|
+
this.sessionStartTime = _data['sessionStartTime']
|
|
877
|
+
? new Date(_data['sessionStartTime'].toString())
|
|
878
|
+
: <any>undefined;
|
|
879
|
+
this.sessionEndTime = _data['sessionEndTime']
|
|
880
|
+
? new Date(_data['sessionEndTime'].toString())
|
|
881
|
+
: <any>undefined;
|
|
882
|
+
this.userName = _data['userName'];
|
|
883
|
+
this.userEmail = _data['userEmail'];
|
|
884
|
+
this.question = _data['question'];
|
|
885
|
+
this.answer = _data['answer'];
|
|
886
|
+
this.messageType = _data['messageType'];
|
|
887
|
+
this.salesforceCaseId = _data['salesforceCaseId'];
|
|
888
|
+
this.guardFlag = _data['guardFlag'];
|
|
889
|
+
this.isGuardrailed = _data['isGuardrailed'];
|
|
890
|
+
this.botVersion = _data['botVersion'];
|
|
891
|
+
this.metadata = _data['metadata'];
|
|
892
|
+
this.feedback = _data['feedback'] ? Feedback.fromJS(_data['feedback']) : <any>undefined;
|
|
893
|
+
this.sessionFeedback = _data['sessionFeedback']
|
|
894
|
+
? Feedback.fromJS(_data['sessionFeedback'])
|
|
895
|
+
: <any>undefined;
|
|
592
896
|
}
|
|
593
897
|
}
|
|
594
898
|
|
|
@@ -601,24 +905,30 @@ export class ExportHistoryMessage implements IExportHistoryMessage {
|
|
|
601
905
|
|
|
602
906
|
toJSON(data?: any) {
|
|
603
907
|
data = typeof data === 'object' ? data : {};
|
|
604
|
-
data[
|
|
605
|
-
data[
|
|
606
|
-
data[
|
|
607
|
-
data[
|
|
608
|
-
data[
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
data[
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
data[
|
|
615
|
-
data[
|
|
616
|
-
data[
|
|
617
|
-
data[
|
|
618
|
-
data[
|
|
619
|
-
data[
|
|
620
|
-
data[
|
|
621
|
-
data[
|
|
908
|
+
data['id'] = this.id;
|
|
909
|
+
data['sessionId'] = this.sessionId;
|
|
910
|
+
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : <any>undefined;
|
|
911
|
+
data['userId'] = this.userId;
|
|
912
|
+
data['sessionStartTime'] = this.sessionStartTime
|
|
913
|
+
? this.sessionStartTime.toISOString()
|
|
914
|
+
: <any>undefined;
|
|
915
|
+
data['sessionEndTime'] = this.sessionEndTime
|
|
916
|
+
? this.sessionEndTime.toISOString()
|
|
917
|
+
: <any>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() : <any>undefined;
|
|
929
|
+
data['sessionFeedback'] = this.sessionFeedback
|
|
930
|
+
? this.sessionFeedback.toJSON()
|
|
931
|
+
: <any>undefined;
|
|
622
932
|
return data;
|
|
623
933
|
}
|
|
624
934
|
}
|
|
@@ -663,24 +973,22 @@ export class Feedback implements IFeedback {
|
|
|
663
973
|
constructor(data?: IFeedback) {
|
|
664
974
|
if (data) {
|
|
665
975
|
for (var property in data) {
|
|
666
|
-
if (data.hasOwnProperty(property))
|
|
667
|
-
(<any>this)[property] = (<any>data)[property];
|
|
976
|
+
if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property];
|
|
668
977
|
}
|
|
669
978
|
}
|
|
670
979
|
}
|
|
671
980
|
|
|
672
981
|
init(_data?: any) {
|
|
673
982
|
if (_data) {
|
|
674
|
-
this.linkUrl = _data[
|
|
675
|
-
this.description = _data[
|
|
676
|
-
this.sessionId = _data[
|
|
677
|
-
this.messageId = _data[
|
|
678
|
-
if (Array.isArray(_data[
|
|
983
|
+
this.linkUrl = _data['linkUrl'];
|
|
984
|
+
this.description = _data['description'];
|
|
985
|
+
this.sessionId = _data['sessionId'];
|
|
986
|
+
this.messageId = _data['messageId'];
|
|
987
|
+
if (Array.isArray(_data['options'])) {
|
|
679
988
|
this.options = [] as any;
|
|
680
|
-
for (let item of _data[
|
|
681
|
-
this.options!.push(item);
|
|
989
|
+
for (let item of _data['options']) this.options!.push(item);
|
|
682
990
|
}
|
|
683
|
-
this.rating = _data[
|
|
991
|
+
this.rating = _data['rating'];
|
|
684
992
|
}
|
|
685
993
|
}
|
|
686
994
|
|
|
@@ -693,16 +1001,15 @@ export class Feedback implements IFeedback {
|
|
|
693
1001
|
|
|
694
1002
|
toJSON(data?: any) {
|
|
695
1003
|
data = typeof data === 'object' ? data : {};
|
|
696
|
-
data[
|
|
697
|
-
data[
|
|
698
|
-
data[
|
|
699
|
-
data[
|
|
1004
|
+
data['linkUrl'] = this.linkUrl;
|
|
1005
|
+
data['description'] = this.description;
|
|
1006
|
+
data['sessionId'] = this.sessionId;
|
|
1007
|
+
data['messageId'] = this.messageId;
|
|
700
1008
|
if (Array.isArray(this.options)) {
|
|
701
|
-
data[
|
|
702
|
-
for (let item of this.options)
|
|
703
|
-
data["options"].push(item);
|
|
1009
|
+
data['options'] = [];
|
|
1010
|
+
for (let item of this.options) data['options'].push(item);
|
|
704
1011
|
}
|
|
705
|
-
data[
|
|
1012
|
+
data['rating'] = this.rating;
|
|
706
1013
|
return data;
|
|
707
1014
|
}
|
|
708
1015
|
}
|
|
@@ -742,8 +1049,7 @@ export class FrontendModel implements IFrontendModel {
|
|
|
742
1049
|
constructor(data?: IFrontendModel) {
|
|
743
1050
|
if (data) {
|
|
744
1051
|
for (var property in data) {
|
|
745
|
-
if (data.hasOwnProperty(property))
|
|
746
|
-
(<any>this)[property] = (<any>data)[property];
|
|
1052
|
+
if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property];
|
|
747
1053
|
}
|
|
748
1054
|
}
|
|
749
1055
|
if (!data) {
|
|
@@ -753,7 +1059,7 @@ export class FrontendModel implements IFrontendModel {
|
|
|
753
1059
|
|
|
754
1060
|
init(_data?: any) {
|
|
755
1061
|
if (_data) {
|
|
756
|
-
this.options = _data[
|
|
1062
|
+
this.options = _data['options'] ? Option.fromJS(_data['options']) : new Option();
|
|
757
1063
|
}
|
|
758
1064
|
}
|
|
759
1065
|
|
|
@@ -766,7 +1072,7 @@ export class FrontendModel implements IFrontendModel {
|
|
|
766
1072
|
|
|
767
1073
|
toJSON(data?: any) {
|
|
768
1074
|
data = typeof data === 'object' ? data : {};
|
|
769
|
-
data[
|
|
1075
|
+
data['options'] = this.options ? this.options.toJSON() : <any>undefined;
|
|
770
1076
|
return data;
|
|
771
1077
|
}
|
|
772
1078
|
}
|
|
@@ -788,21 +1094,19 @@ export class Option implements IOption {
|
|
|
788
1094
|
constructor(data?: IOption) {
|
|
789
1095
|
if (data) {
|
|
790
1096
|
for (var property in data) {
|
|
791
|
-
if (data.hasOwnProperty(property))
|
|
792
|
-
(<any>this)[property] = (<any>data)[property];
|
|
1097
|
+
if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property];
|
|
793
1098
|
}
|
|
794
1099
|
}
|
|
795
1100
|
}
|
|
796
1101
|
|
|
797
1102
|
init(_data?: any) {
|
|
798
1103
|
if (_data) {
|
|
799
|
-
this.key = _data[
|
|
800
|
-
this.displayName = _data[
|
|
801
|
-
this.type = _data[
|
|
802
|
-
if (Array.isArray(_data[
|
|
1104
|
+
this.key = _data['key'];
|
|
1105
|
+
this.displayName = _data['displayName'];
|
|
1106
|
+
this.type = _data['type'];
|
|
1107
|
+
if (Array.isArray(_data['subOptions'])) {
|
|
803
1108
|
this.subOptions = [] as any;
|
|
804
|
-
for (let item of _data[
|
|
805
|
-
this.subOptions!.push(Option.fromJS(item));
|
|
1109
|
+
for (let item of _data['subOptions']) this.subOptions!.push(Option.fromJS(item));
|
|
806
1110
|
}
|
|
807
1111
|
}
|
|
808
1112
|
}
|
|
@@ -816,13 +1120,12 @@ export class Option implements IOption {
|
|
|
816
1120
|
|
|
817
1121
|
toJSON(data?: any) {
|
|
818
1122
|
data = typeof data === 'object' ? data : {};
|
|
819
|
-
data[
|
|
820
|
-
data[
|
|
821
|
-
data[
|
|
1123
|
+
data['key'] = this.key;
|
|
1124
|
+
data['displayName'] = this.displayName;
|
|
1125
|
+
data['type'] = this.type;
|
|
822
1126
|
if (Array.isArray(this.subOptions)) {
|
|
823
|
-
data[
|
|
824
|
-
for (let item of this.subOptions)
|
|
825
|
-
data["subOptions"].push(item.toJSON());
|
|
1127
|
+
data['subOptions'] = [];
|
|
1128
|
+
for (let item of this.subOptions) data['subOptions'].push(item.toJSON());
|
|
826
1129
|
}
|
|
827
1130
|
return data;
|
|
828
1131
|
}
|
|
@@ -854,17 +1157,16 @@ export class ScoredUrl implements IScoredUrl {
|
|
|
854
1157
|
constructor(data?: IScoredUrl) {
|
|
855
1158
|
if (data) {
|
|
856
1159
|
for (var property in data) {
|
|
857
|
-
if (data.hasOwnProperty(property))
|
|
858
|
-
(<any>this)[property] = (<any>data)[property];
|
|
1160
|
+
if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property];
|
|
859
1161
|
}
|
|
860
1162
|
}
|
|
861
1163
|
}
|
|
862
1164
|
|
|
863
1165
|
init(_data?: any) {
|
|
864
1166
|
if (_data) {
|
|
865
|
-
this.url = _data[
|
|
866
|
-
this.score = _data[
|
|
867
|
-
this.title = _data[
|
|
1167
|
+
this.url = _data['url'];
|
|
1168
|
+
this.score = _data['score'];
|
|
1169
|
+
this.title = _data['title'];
|
|
868
1170
|
}
|
|
869
1171
|
}
|
|
870
1172
|
|
|
@@ -877,9 +1179,9 @@ export class ScoredUrl implements IScoredUrl {
|
|
|
877
1179
|
|
|
878
1180
|
toJSON(data?: any) {
|
|
879
1181
|
data = typeof data === 'object' ? data : {};
|
|
880
|
-
data[
|
|
881
|
-
data[
|
|
882
|
-
data[
|
|
1182
|
+
data['url'] = this.url;
|
|
1183
|
+
data['score'] = this.score;
|
|
1184
|
+
data['title'] = this.title;
|
|
883
1185
|
return data;
|
|
884
1186
|
}
|
|
885
1187
|
}
|
|
@@ -896,29 +1198,29 @@ export class Selections implements ISelections {
|
|
|
896
1198
|
/** Selected values. */
|
|
897
1199
|
values?: string[] | undefined;
|
|
898
1200
|
/** Child selections down the hierarchy. */
|
|
899
|
-
subOptions?: { [key: string]: Selections
|
|
1201
|
+
subOptions?: { [key: string]: Selections } | undefined;
|
|
900
1202
|
|
|
901
1203
|
constructor(data?: ISelections) {
|
|
902
1204
|
if (data) {
|
|
903
1205
|
for (var property in data) {
|
|
904
|
-
if (data.hasOwnProperty(property))
|
|
905
|
-
(<any>this)[property] = (<any>data)[property];
|
|
1206
|
+
if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property];
|
|
906
1207
|
}
|
|
907
1208
|
}
|
|
908
1209
|
}
|
|
909
1210
|
|
|
910
1211
|
init(_data?: any) {
|
|
911
1212
|
if (_data) {
|
|
912
|
-
if (Array.isArray(_data[
|
|
1213
|
+
if (Array.isArray(_data['values'])) {
|
|
913
1214
|
this.values = [] as any;
|
|
914
|
-
for (let item of _data[
|
|
915
|
-
this.values!.push(item);
|
|
1215
|
+
for (let item of _data['values']) this.values!.push(item);
|
|
916
1216
|
}
|
|
917
|
-
if (_data[
|
|
1217
|
+
if (_data['subOptions']) {
|
|
918
1218
|
this.subOptions = {} as any;
|
|
919
|
-
for (let key in _data[
|
|
920
|
-
if (_data[
|
|
921
|
-
(<any>this.subOptions)![key] = _data[
|
|
1219
|
+
for (let key in _data['subOptions']) {
|
|
1220
|
+
if (_data['subOptions'].hasOwnProperty(key))
|
|
1221
|
+
(<any>this.subOptions)![key] = _data['subOptions'][key]
|
|
1222
|
+
? Selections.fromJS(_data['subOptions'][key])
|
|
1223
|
+
: new Selections();
|
|
922
1224
|
}
|
|
923
1225
|
}
|
|
924
1226
|
}
|
|
@@ -934,15 +1236,16 @@ export class Selections implements ISelections {
|
|
|
934
1236
|
toJSON(data?: any) {
|
|
935
1237
|
data = typeof data === 'object' ? data : {};
|
|
936
1238
|
if (Array.isArray(this.values)) {
|
|
937
|
-
data[
|
|
938
|
-
for (let item of this.values)
|
|
939
|
-
data["values"].push(item);
|
|
1239
|
+
data['values'] = [];
|
|
1240
|
+
for (let item of this.values) data['values'].push(item);
|
|
940
1241
|
}
|
|
941
1242
|
if (this.subOptions) {
|
|
942
|
-
data[
|
|
1243
|
+
data['subOptions'] = {};
|
|
943
1244
|
for (let key in this.subOptions) {
|
|
944
1245
|
if (this.subOptions.hasOwnProperty(key))
|
|
945
|
-
(<any>data[
|
|
1246
|
+
(<any>data['subOptions'])[key] = this.subOptions[key]
|
|
1247
|
+
? this.subOptions[key].toJSON()
|
|
1248
|
+
: <any>undefined;
|
|
946
1249
|
}
|
|
947
1250
|
}
|
|
948
1251
|
return data;
|
|
@@ -954,7 +1257,7 @@ export interface ISelections {
|
|
|
954
1257
|
/** Selected values. */
|
|
955
1258
|
values?: string[] | undefined;
|
|
956
1259
|
/** Child selections down the hierarchy. */
|
|
957
|
-
subOptions?: { [key: string]: Selections
|
|
1260
|
+
subOptions?: { [key: string]: Selections } | undefined;
|
|
958
1261
|
}
|
|
959
1262
|
|
|
960
1263
|
/** Series of chatbot exchanges making a conversation. */
|
|
@@ -962,25 +1265,24 @@ export class Session implements ISession {
|
|
|
962
1265
|
/** Primary key. */
|
|
963
1266
|
id?: number;
|
|
964
1267
|
/** Arbitrary data to be stored in session. */
|
|
965
|
-
data?: { [key: string]: string
|
|
1268
|
+
data?: { [key: string]: string } | undefined;
|
|
966
1269
|
|
|
967
1270
|
constructor(data?: ISession) {
|
|
968
1271
|
if (data) {
|
|
969
1272
|
for (var property in data) {
|
|
970
|
-
if (data.hasOwnProperty(property))
|
|
971
|
-
(<any>this)[property] = (<any>data)[property];
|
|
1273
|
+
if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property];
|
|
972
1274
|
}
|
|
973
1275
|
}
|
|
974
1276
|
}
|
|
975
1277
|
|
|
976
1278
|
init(_data?: any) {
|
|
977
1279
|
if (_data) {
|
|
978
|
-
this.id = _data[
|
|
979
|
-
if (_data[
|
|
1280
|
+
this.id = _data['id'];
|
|
1281
|
+
if (_data['data']) {
|
|
980
1282
|
this.data = {} as any;
|
|
981
|
-
for (let key in _data[
|
|
982
|
-
if (_data[
|
|
983
|
-
(<any>this.data)![key] = _data[
|
|
1283
|
+
for (let key in _data['data']) {
|
|
1284
|
+
if (_data['data'].hasOwnProperty(key))
|
|
1285
|
+
(<any>this.data)![key] = _data['data'][key];
|
|
984
1286
|
}
|
|
985
1287
|
}
|
|
986
1288
|
}
|
|
@@ -995,12 +1297,11 @@ export class Session implements ISession {
|
|
|
995
1297
|
|
|
996
1298
|
toJSON(data?: any) {
|
|
997
1299
|
data = typeof data === 'object' ? data : {};
|
|
998
|
-
data[
|
|
1300
|
+
data['id'] = this.id;
|
|
999
1301
|
if (this.data) {
|
|
1000
|
-
data[
|
|
1302
|
+
data['data'] = {};
|
|
1001
1303
|
for (let key in this.data) {
|
|
1002
|
-
if (this.data.hasOwnProperty(key))
|
|
1003
|
-
(<any>data["data"])[key] = (<any>this.data)[key];
|
|
1304
|
+
if (this.data.hasOwnProperty(key)) (<any>data['data'])[key] = (<any>this.data)[key];
|
|
1004
1305
|
}
|
|
1005
1306
|
}
|
|
1006
1307
|
return data;
|
|
@@ -1012,7 +1313,7 @@ export interface ISession {
|
|
|
1012
1313
|
/** Primary key. */
|
|
1013
1314
|
id?: number;
|
|
1014
1315
|
/** Arbitrary data to be stored in session. */
|
|
1015
|
-
data?: { [key: string]: string
|
|
1316
|
+
data?: { [key: string]: string } | undefined;
|
|
1016
1317
|
}
|
|
1017
1318
|
|
|
1018
1319
|
/** User request message. */
|
|
@@ -1027,30 +1328,33 @@ export class UserMessage implements IUserMessage {
|
|
|
1027
1328
|
experience!: Experience;
|
|
1028
1329
|
selections?: Selections;
|
|
1029
1330
|
/** Additional context. */
|
|
1030
|
-
context?: { [key: string]: any
|
|
1331
|
+
context?: { [key: string]: any } | undefined;
|
|
1031
1332
|
|
|
1032
1333
|
constructor(data?: IUserMessage) {
|
|
1033
1334
|
if (data) {
|
|
1034
1335
|
for (var property in data) {
|
|
1035
|
-
if (data.hasOwnProperty(property))
|
|
1036
|
-
(<any>this)[property] = (<any>data)[property];
|
|
1336
|
+
if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property];
|
|
1037
1337
|
}
|
|
1038
1338
|
}
|
|
1039
1339
|
}
|
|
1040
1340
|
|
|
1041
1341
|
init(_data?: any) {
|
|
1042
1342
|
if (_data) {
|
|
1043
|
-
this.id = _data[
|
|
1044
|
-
this.sessionId = _data[
|
|
1045
|
-
this.timeStamp = _data[
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
this.
|
|
1049
|
-
|
|
1343
|
+
this.id = _data['id'];
|
|
1344
|
+
this.sessionId = _data['sessionId'];
|
|
1345
|
+
this.timeStamp = _data['timeStamp']
|
|
1346
|
+
? new Date(_data['timeStamp'].toString())
|
|
1347
|
+
: <any>undefined;
|
|
1348
|
+
this.question = _data['question'];
|
|
1349
|
+
this.experience = _data['experience'];
|
|
1350
|
+
this.selections = _data['selections']
|
|
1351
|
+
? Selections.fromJS(_data['selections'])
|
|
1352
|
+
: <any>undefined;
|
|
1353
|
+
if (_data['context']) {
|
|
1050
1354
|
this.context = {} as any;
|
|
1051
|
-
for (let key in _data[
|
|
1052
|
-
if (_data[
|
|
1053
|
-
(<any>this.context)![key] = _data[
|
|
1355
|
+
for (let key in _data['context']) {
|
|
1356
|
+
if (_data['context'].hasOwnProperty(key))
|
|
1357
|
+
(<any>this.context)![key] = _data['context'][key];
|
|
1054
1358
|
}
|
|
1055
1359
|
}
|
|
1056
1360
|
}
|
|
@@ -1065,17 +1369,17 @@ export class UserMessage implements IUserMessage {
|
|
|
1065
1369
|
|
|
1066
1370
|
toJSON(data?: any) {
|
|
1067
1371
|
data = typeof data === 'object' ? data : {};
|
|
1068
|
-
data[
|
|
1069
|
-
data[
|
|
1070
|
-
data[
|
|
1071
|
-
data[
|
|
1072
|
-
data[
|
|
1073
|
-
data[
|
|
1372
|
+
data['id'] = this.id;
|
|
1373
|
+
data['sessionId'] = this.sessionId;
|
|
1374
|
+
data['timeStamp'] = this.timeStamp ? this.timeStamp.toISOString() : <any>undefined;
|
|
1375
|
+
data['question'] = this.question;
|
|
1376
|
+
data['experience'] = this.experience;
|
|
1377
|
+
data['selections'] = this.selections ? this.selections.toJSON() : <any>undefined;
|
|
1074
1378
|
if (this.context) {
|
|
1075
|
-
data[
|
|
1379
|
+
data['context'] = {};
|
|
1076
1380
|
for (let key in this.context) {
|
|
1077
1381
|
if (this.context.hasOwnProperty(key))
|
|
1078
|
-
(<any>data[
|
|
1382
|
+
(<any>data['context'])[key] = (<any>this.context)[key];
|
|
1079
1383
|
}
|
|
1080
1384
|
}
|
|
1081
1385
|
return data;
|
|
@@ -1094,17 +1398,23 @@ export interface IUserMessage {
|
|
|
1094
1398
|
experience: Experience;
|
|
1095
1399
|
selections?: Selections;
|
|
1096
1400
|
/** Additional context. */
|
|
1097
|
-
context?: { [key: string]: any
|
|
1401
|
+
context?: { [key: string]: any } | undefined;
|
|
1098
1402
|
}
|
|
1099
1403
|
|
|
1100
1404
|
export class ApiException extends Error {
|
|
1101
1405
|
message: string;
|
|
1102
1406
|
status: number;
|
|
1103
1407
|
response: string;
|
|
1104
|
-
headers: { [key: string]: any
|
|
1408
|
+
headers: { [key: string]: any };
|
|
1105
1409
|
result: any;
|
|
1106
1410
|
|
|
1107
|
-
constructor(
|
|
1411
|
+
constructor(
|
|
1412
|
+
message: string,
|
|
1413
|
+
status: number,
|
|
1414
|
+
response: string,
|
|
1415
|
+
headers: { [key: string]: any },
|
|
1416
|
+
result: any
|
|
1417
|
+
) {
|
|
1108
1418
|
super();
|
|
1109
1419
|
|
|
1110
1420
|
this.message = message;
|
|
@@ -1121,9 +1431,17 @@ export class ApiException extends Error {
|
|
|
1121
1431
|
}
|
|
1122
1432
|
}
|
|
1123
1433
|
|
|
1124
|
-
function throwException(
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1434
|
+
function throwException(
|
|
1435
|
+
message: string,
|
|
1436
|
+
status: number,
|
|
1437
|
+
response: string,
|
|
1438
|
+
headers: { [key: string]: any },
|
|
1439
|
+
result?: any
|
|
1440
|
+
): any {
|
|
1441
|
+
if (result !== null && result !== undefined) throw result;
|
|
1442
|
+
else throw new ApiException(message, status, response, headers, null);
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
function isAxiosError(obj: any): obj is AxiosError {
|
|
1446
|
+
return obj && obj.isAxiosError === true;
|
|
1447
|
+
}
|