@wildix/wim-voicebots-client 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist-cjs/VoiceBots.js +31 -0
  2. package/dist-cjs/VoiceBotsClient.js +42 -0
  3. package/dist-cjs/commands/CreateVoiceBotCommand.js +21 -0
  4. package/dist-cjs/commands/DeleteVoiceBotCommand.js +21 -0
  5. package/dist-cjs/commands/DescribeEventCommand.js +21 -0
  6. package/dist-cjs/commands/GetVoiceBotCommand.js +21 -0
  7. package/dist-cjs/commands/ListVoiceBotsCommand.js +21 -0
  8. package/dist-cjs/commands/ListVoiceBotsNamesCommand.js +21 -0
  9. package/dist-cjs/commands/SendHangupCommand.js +21 -0
  10. package/dist-cjs/commands/SendSayCommand.js +21 -0
  11. package/dist-cjs/commands/SendTransferCommand.js +21 -0
  12. package/dist-cjs/commands/UpdateVoiceBotCommand.js +21 -0
  13. package/dist-cjs/commands/index.js +13 -0
  14. package/dist-cjs/extensionConfiguration.js +2 -0
  15. package/dist-cjs/index.js +10 -0
  16. package/dist-cjs/models/VoiceBotsServiceException.js +12 -0
  17. package/dist-cjs/models/index.js +4 -0
  18. package/dist-cjs/models/models_0.js +78 -0
  19. package/dist-cjs/protocols/Aws_restJson1.js +539 -0
  20. package/dist-cjs/runtimeConfig.browser.js +32 -0
  21. package/dist-cjs/runtimeConfig.js +36 -0
  22. package/dist-cjs/runtimeConfig.native.js +15 -0
  23. package/dist-cjs/runtimeConfig.shared.js +21 -0
  24. package/dist-cjs/runtimeExtensions.js +19 -0
  25. package/dist-es/VoiceBots.js +27 -0
  26. package/dist-es/VoiceBotsClient.js +38 -0
  27. package/dist-es/commands/CreateVoiceBotCommand.js +17 -0
  28. package/dist-es/commands/DeleteVoiceBotCommand.js +17 -0
  29. package/dist-es/commands/DescribeEventCommand.js +17 -0
  30. package/dist-es/commands/GetVoiceBotCommand.js +17 -0
  31. package/dist-es/commands/ListVoiceBotsCommand.js +17 -0
  32. package/dist-es/commands/ListVoiceBotsNamesCommand.js +17 -0
  33. package/dist-es/commands/SendHangupCommand.js +17 -0
  34. package/dist-es/commands/SendSayCommand.js +17 -0
  35. package/dist-es/commands/SendTransferCommand.js +17 -0
  36. package/dist-es/commands/UpdateVoiceBotCommand.js +17 -0
  37. package/dist-es/commands/index.js +10 -0
  38. package/dist-es/extensionConfiguration.js +1 -0
  39. package/dist-es/index.js +5 -0
  40. package/dist-es/models/VoiceBotsServiceException.js +8 -0
  41. package/dist-es/models/index.js +1 -0
  42. package/dist-es/models/models_0.js +71 -0
  43. package/dist-es/protocols/Aws_restJson1.js +516 -0
  44. package/dist-es/runtimeConfig.browser.js +27 -0
  45. package/dist-es/runtimeConfig.js +31 -0
  46. package/dist-es/runtimeConfig.native.js +11 -0
  47. package/dist-es/runtimeConfig.shared.js +17 -0
  48. package/dist-es/runtimeExtensions.js +15 -0
  49. package/dist-types/VoiceBots.d.ts +82 -0
  50. package/dist-types/VoiceBotsClient.d.ts +153 -0
  51. package/dist-types/commands/CreateVoiceBotCommand.d.ts +120 -0
  52. package/dist-types/commands/DeleteVoiceBotCommand.d.ts +63 -0
  53. package/dist-types/commands/DescribeEventCommand.d.ts +141 -0
  54. package/dist-types/commands/GetVoiceBotCommand.d.ts +97 -0
  55. package/dist-types/commands/ListVoiceBotsCommand.d.ts +96 -0
  56. package/dist-types/commands/ListVoiceBotsNamesCommand.d.ts +69 -0
  57. package/dist-types/commands/SendHangupCommand.d.ts +65 -0
  58. package/dist-types/commands/SendSayCommand.d.ts +67 -0
  59. package/dist-types/commands/SendTransferCommand.d.ts +66 -0
  60. package/dist-types/commands/UpdateVoiceBotCommand.d.ts +123 -0
  61. package/dist-types/commands/index.d.ts +10 -0
  62. package/dist-types/extensionConfiguration.d.ts +7 -0
  63. package/dist-types/index.d.ts +7 -0
  64. package/dist-types/models/VoiceBotsServiceException.d.ts +14 -0
  65. package/dist-types/models/index.d.ts +1 -0
  66. package/dist-types/models/models_0.d.ts +492 -0
  67. package/dist-types/protocols/Aws_restJson1.d.ts +92 -0
  68. package/dist-types/runtimeConfig.browser.d.ts +29 -0
  69. package/dist-types/runtimeConfig.d.ts +29 -0
  70. package/dist-types/runtimeConfig.native.d.ts +28 -0
  71. package/dist-types/runtimeConfig.shared.d.ts +15 -0
  72. package/dist-types/runtimeExtensions.d.ts +17 -0
  73. package/package.json +79 -0
@@ -0,0 +1,539 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.de_UpdateVoiceBotCommand = exports.de_SendTransferCommand = exports.de_SendSayCommand = exports.de_SendHangupCommand = exports.de_ListVoiceBotsNamesCommand = exports.de_ListVoiceBotsCommand = exports.de_GetVoiceBotCommand = exports.de_DescribeEventCommand = exports.de_DeleteVoiceBotCommand = exports.de_CreateVoiceBotCommand = exports.se_UpdateVoiceBotCommand = exports.se_SendTransferCommand = exports.se_SendSayCommand = exports.se_SendHangupCommand = exports.se_ListVoiceBotsNamesCommand = exports.se_ListVoiceBotsCommand = exports.se_GetVoiceBotCommand = exports.se_DescribeEventCommand = exports.se_DeleteVoiceBotCommand = exports.se_CreateVoiceBotCommand = void 0;
4
+ const VoiceBotsServiceException_1 = require("../models/VoiceBotsServiceException");
5
+ const models_0_1 = require("../models/models_0");
6
+ const core_1 = require("@smithy/core");
7
+ const smithy_client_1 = require("@smithy/smithy-client");
8
+ const se_CreateVoiceBotCommand = async (input, context) => {
9
+ const b = (0, core_1.requestBuilder)(input, context);
10
+ const headers = {
11
+ 'content-type': 'application/json',
12
+ };
13
+ b.bp("/v2/voicebots/bots");
14
+ const query = (0, smithy_client_1.map)({
15
+ [_c]: [, input[_c]],
16
+ });
17
+ let body;
18
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
19
+ 'endpoint': _ => se_BotEndpoint(_, context),
20
+ 'languageCode': [],
21
+ 'maximumDuration': [],
22
+ 'name': [],
23
+ 'silenceTimeout': [],
24
+ 'voiceId': [],
25
+ }));
26
+ b.m("POST")
27
+ .h(headers)
28
+ .q(query)
29
+ .b(body);
30
+ return b.build();
31
+ };
32
+ exports.se_CreateVoiceBotCommand = se_CreateVoiceBotCommand;
33
+ const se_DeleteVoiceBotCommand = async (input, context) => {
34
+ const b = (0, core_1.requestBuilder)(input, context);
35
+ const headers = {};
36
+ b.bp("/v2/voicebots/bots/{botId}");
37
+ b.p('botId', () => input.botId, '{botId}', false);
38
+ const query = (0, smithy_client_1.map)({
39
+ [_c]: [, input[_c]],
40
+ });
41
+ let body;
42
+ b.m("DELETE")
43
+ .h(headers)
44
+ .q(query)
45
+ .b(body);
46
+ return b.build();
47
+ };
48
+ exports.se_DeleteVoiceBotCommand = se_DeleteVoiceBotCommand;
49
+ const se_DescribeEventCommand = async (input, context) => {
50
+ const b = (0, core_1.requestBuilder)(input, context);
51
+ const headers = {
52
+ 'content-type': 'application/json',
53
+ };
54
+ b.bp("/v2/voicebots/describe");
55
+ let body;
56
+ body = "";
57
+ b.m("POST")
58
+ .h(headers)
59
+ .b(body);
60
+ return b.build();
61
+ };
62
+ exports.se_DescribeEventCommand = se_DescribeEventCommand;
63
+ const se_GetVoiceBotCommand = async (input, context) => {
64
+ const b = (0, core_1.requestBuilder)(input, context);
65
+ const headers = {};
66
+ b.bp("/v2/voicebots/bots/{botId}");
67
+ b.p('botId', () => input.botId, '{botId}', false);
68
+ const query = (0, smithy_client_1.map)({
69
+ [_c]: [, input[_c]],
70
+ });
71
+ let body;
72
+ b.m("GET")
73
+ .h(headers)
74
+ .q(query)
75
+ .b(body);
76
+ return b.build();
77
+ };
78
+ exports.se_GetVoiceBotCommand = se_GetVoiceBotCommand;
79
+ const se_ListVoiceBotsCommand = async (input, context) => {
80
+ const b = (0, core_1.requestBuilder)(input, context);
81
+ const headers = {};
82
+ b.bp("/v2/voicebots/bots");
83
+ const query = (0, smithy_client_1.map)({
84
+ [_c]: [, input[_c]],
85
+ });
86
+ let body;
87
+ b.m("GET")
88
+ .h(headers)
89
+ .q(query)
90
+ .b(body);
91
+ return b.build();
92
+ };
93
+ exports.se_ListVoiceBotsCommand = se_ListVoiceBotsCommand;
94
+ const se_ListVoiceBotsNamesCommand = async (input, context) => {
95
+ const b = (0, core_1.requestBuilder)(input, context);
96
+ const headers = {};
97
+ b.bp("/v2/voicebots/names");
98
+ const query = (0, smithy_client_1.map)({
99
+ [_c]: [, input[_c]],
100
+ });
101
+ let body;
102
+ b.m("GET")
103
+ .h(headers)
104
+ .q(query)
105
+ .b(body);
106
+ return b.build();
107
+ };
108
+ exports.se_ListVoiceBotsNamesCommand = se_ListVoiceBotsNamesCommand;
109
+ const se_SendHangupCommand = async (input, context) => {
110
+ const b = (0, core_1.requestBuilder)(input, context);
111
+ const headers = {
112
+ 'content-type': 'application/json',
113
+ };
114
+ b.bp("/v2/voicebots/sessions/{sessionId}/hangup");
115
+ b.p('sessionId', () => input.sessionId, '{sessionId}', false);
116
+ let body;
117
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
118
+ 'reason': [],
119
+ }));
120
+ b.m("POST")
121
+ .h(headers)
122
+ .b(body);
123
+ return b.build();
124
+ };
125
+ exports.se_SendHangupCommand = se_SendHangupCommand;
126
+ const se_SendSayCommand = async (input, context) => {
127
+ const b = (0, core_1.requestBuilder)(input, context);
128
+ const headers = {
129
+ 'content-type': 'application/json',
130
+ };
131
+ b.bp("/v2/voicebots/sessions/{sessionId}/say");
132
+ b.p('sessionId', () => input.sessionId, '{sessionId}', false);
133
+ let body;
134
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
135
+ 'interruptible': [],
136
+ 'replyId': [],
137
+ 'text': [],
138
+ }));
139
+ b.m("POST")
140
+ .h(headers)
141
+ .b(body);
142
+ return b.build();
143
+ };
144
+ exports.se_SendSayCommand = se_SendSayCommand;
145
+ const se_SendTransferCommand = async (input, context) => {
146
+ const b = (0, core_1.requestBuilder)(input, context);
147
+ const headers = {
148
+ 'content-type': 'application/json',
149
+ };
150
+ b.bp("/v2/voicebots/sessions/{sessionId}/transfer");
151
+ b.p('sessionId', () => input.sessionId, '{sessionId}', false);
152
+ let body;
153
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
154
+ 'context': [],
155
+ 'extension': [],
156
+ }));
157
+ b.m("POST")
158
+ .h(headers)
159
+ .b(body);
160
+ return b.build();
161
+ };
162
+ exports.se_SendTransferCommand = se_SendTransferCommand;
163
+ const se_UpdateVoiceBotCommand = async (input, context) => {
164
+ const b = (0, core_1.requestBuilder)(input, context);
165
+ const headers = {
166
+ 'content-type': 'application/json',
167
+ };
168
+ b.bp("/v2/voicebots/bots/{botId}");
169
+ b.p('botId', () => input.botId, '{botId}', false);
170
+ const query = (0, smithy_client_1.map)({
171
+ [_c]: [, input[_c]],
172
+ });
173
+ let body;
174
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
175
+ 'endpoint': _ => se_BotEndpoint(_, context),
176
+ 'languageCode': [],
177
+ 'maximumDuration': [],
178
+ 'name': [],
179
+ 'silenceTimeout': [],
180
+ 'voiceId': [],
181
+ }));
182
+ b.m("PUT")
183
+ .h(headers)
184
+ .q(query)
185
+ .b(body);
186
+ return b.build();
187
+ };
188
+ exports.se_UpdateVoiceBotCommand = se_UpdateVoiceBotCommand;
189
+ const de_CreateVoiceBotCommand = async (output, context) => {
190
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
191
+ return de_CommandError(output, context);
192
+ }
193
+ const contents = (0, smithy_client_1.map)({
194
+ $metadata: deserializeMetadata(output),
195
+ });
196
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
197
+ const doc = (0, smithy_client_1.take)(data, {
198
+ 'bot': _ => de_VoiceBot(_, context),
199
+ });
200
+ Object.assign(contents, doc);
201
+ return contents;
202
+ };
203
+ exports.de_CreateVoiceBotCommand = de_CreateVoiceBotCommand;
204
+ const de_DeleteVoiceBotCommand = async (output, context) => {
205
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
206
+ return de_CommandError(output, context);
207
+ }
208
+ const contents = (0, smithy_client_1.map)({
209
+ $metadata: deserializeMetadata(output),
210
+ });
211
+ await (0, smithy_client_1.collectBody)(output.body, context);
212
+ return contents;
213
+ };
214
+ exports.de_DeleteVoiceBotCommand = de_DeleteVoiceBotCommand;
215
+ const de_DescribeEventCommand = async (output, context) => {
216
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
217
+ return de_CommandError(output, context);
218
+ }
219
+ const contents = (0, smithy_client_1.map)({
220
+ $metadata: deserializeMetadata(output),
221
+ });
222
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
223
+ const doc = (0, smithy_client_1.take)(data, {
224
+ 'VoiceBotInterruptionWebhookEvent': smithy_client_1._json,
225
+ 'VoiceBotInterruptionWebsocketEvent': smithy_client_1._json,
226
+ 'VoiceBotReplyWebhookEvent': smithy_client_1._json,
227
+ 'VoiceBotReplyWebsocketEvent': smithy_client_1._json,
228
+ 'VoiceBotSessionEndedWebhookEvent': smithy_client_1._json,
229
+ 'VoiceBotSessionEndedWebsocketEvent': smithy_client_1._json,
230
+ 'VoiceBotTranscriptionWebhookEvent': smithy_client_1._json,
231
+ 'VoiceBotTranscriptionWebsocketEvent': smithy_client_1._json,
232
+ });
233
+ Object.assign(contents, doc);
234
+ return contents;
235
+ };
236
+ exports.de_DescribeEventCommand = de_DescribeEventCommand;
237
+ const de_GetVoiceBotCommand = async (output, context) => {
238
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
239
+ return de_CommandError(output, context);
240
+ }
241
+ const contents = (0, smithy_client_1.map)({
242
+ $metadata: deserializeMetadata(output),
243
+ });
244
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
245
+ const doc = (0, smithy_client_1.take)(data, {
246
+ 'bot': _ => de_VoiceBot(_, context),
247
+ });
248
+ Object.assign(contents, doc);
249
+ return contents;
250
+ };
251
+ exports.de_GetVoiceBotCommand = de_GetVoiceBotCommand;
252
+ const de_ListVoiceBotsCommand = async (output, context) => {
253
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
254
+ return de_CommandError(output, context);
255
+ }
256
+ const contents = (0, smithy_client_1.map)({
257
+ $metadata: deserializeMetadata(output),
258
+ });
259
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
260
+ const doc = (0, smithy_client_1.take)(data, {
261
+ 'bots': _ => de_VoiceBotsList(_, context),
262
+ });
263
+ Object.assign(contents, doc);
264
+ return contents;
265
+ };
266
+ exports.de_ListVoiceBotsCommand = de_ListVoiceBotsCommand;
267
+ const de_ListVoiceBotsNamesCommand = async (output, context) => {
268
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
269
+ return de_CommandError(output, context);
270
+ }
271
+ const contents = (0, smithy_client_1.map)({
272
+ $metadata: deserializeMetadata(output),
273
+ });
274
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
275
+ const doc = (0, smithy_client_1.take)(data, {
276
+ 'bots': smithy_client_1._json,
277
+ });
278
+ Object.assign(contents, doc);
279
+ return contents;
280
+ };
281
+ exports.de_ListVoiceBotsNamesCommand = de_ListVoiceBotsNamesCommand;
282
+ const de_SendHangupCommand = async (output, context) => {
283
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
284
+ return de_CommandError(output, context);
285
+ }
286
+ const contents = (0, smithy_client_1.map)({
287
+ $metadata: deserializeMetadata(output),
288
+ });
289
+ await (0, smithy_client_1.collectBody)(output.body, context);
290
+ return contents;
291
+ };
292
+ exports.de_SendHangupCommand = de_SendHangupCommand;
293
+ const de_SendSayCommand = async (output, context) => {
294
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
295
+ return de_CommandError(output, context);
296
+ }
297
+ const contents = (0, smithy_client_1.map)({
298
+ $metadata: deserializeMetadata(output),
299
+ });
300
+ await (0, smithy_client_1.collectBody)(output.body, context);
301
+ return contents;
302
+ };
303
+ exports.de_SendSayCommand = de_SendSayCommand;
304
+ const de_SendTransferCommand = async (output, context) => {
305
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
306
+ return de_CommandError(output, context);
307
+ }
308
+ const contents = (0, smithy_client_1.map)({
309
+ $metadata: deserializeMetadata(output),
310
+ });
311
+ await (0, smithy_client_1.collectBody)(output.body, context);
312
+ return contents;
313
+ };
314
+ exports.de_SendTransferCommand = de_SendTransferCommand;
315
+ const de_UpdateVoiceBotCommand = async (output, context) => {
316
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
317
+ return de_CommandError(output, context);
318
+ }
319
+ const contents = (0, smithy_client_1.map)({
320
+ $metadata: deserializeMetadata(output),
321
+ });
322
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
323
+ const doc = (0, smithy_client_1.take)(data, {
324
+ 'bot': _ => de_VoiceBot(_, context),
325
+ });
326
+ Object.assign(contents, doc);
327
+ return contents;
328
+ };
329
+ exports.de_UpdateVoiceBotCommand = de_UpdateVoiceBotCommand;
330
+ const de_CommandError = async (output, context) => {
331
+ const parsedOutput = {
332
+ ...output,
333
+ body: await parseErrorBody(output.body, context)
334
+ };
335
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
336
+ switch (errorCode) {
337
+ case "ForbiddenException":
338
+ case "smithy.framework#ForbiddenException":
339
+ throw await de_ForbiddenExceptionRes(parsedOutput, context);
340
+ case "ValidationException":
341
+ case "smithy.framework#ValidationException":
342
+ throw await de_ValidationExceptionRes(parsedOutput, context);
343
+ case "VoiceBotNotFoundException":
344
+ case "wildix.wim.voicebots#VoiceBotNotFoundException":
345
+ throw await de_VoiceBotNotFoundExceptionRes(parsedOutput, context);
346
+ case "VoiceSessionNotFoundException":
347
+ case "wildix.wim.voicebots#VoiceSessionNotFoundException":
348
+ throw await de_VoiceSessionNotFoundExceptionRes(parsedOutput, context);
349
+ default:
350
+ const parsedBody = parsedOutput.body;
351
+ return throwDefaultError({
352
+ output,
353
+ parsedBody,
354
+ errorCode
355
+ });
356
+ }
357
+ };
358
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(VoiceBotsServiceException_1.VoiceBotsServiceException);
359
+ const de_ForbiddenExceptionRes = async (parsedOutput, context) => {
360
+ const contents = (0, smithy_client_1.map)({});
361
+ const data = parsedOutput.body;
362
+ const doc = (0, smithy_client_1.take)(data, {
363
+ 'message': smithy_client_1.expectString,
364
+ });
365
+ Object.assign(contents, doc);
366
+ const exception = new models_0_1.ForbiddenException({
367
+ $metadata: deserializeMetadata(parsedOutput),
368
+ ...contents
369
+ });
370
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
371
+ };
372
+ const de_ValidationExceptionRes = async (parsedOutput, context) => {
373
+ const contents = (0, smithy_client_1.map)({});
374
+ const data = parsedOutput.body;
375
+ const doc = (0, smithy_client_1.take)(data, {
376
+ 'message': smithy_client_1.expectString,
377
+ });
378
+ Object.assign(contents, doc);
379
+ const exception = new models_0_1.ValidationException({
380
+ $metadata: deserializeMetadata(parsedOutput),
381
+ ...contents
382
+ });
383
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
384
+ };
385
+ const de_VoiceBotNotFoundExceptionRes = async (parsedOutput, context) => {
386
+ const contents = (0, smithy_client_1.map)({});
387
+ const data = parsedOutput.body;
388
+ const doc = (0, smithy_client_1.take)(data, {
389
+ 'message': smithy_client_1.expectString,
390
+ 'type': smithy_client_1.expectString,
391
+ });
392
+ Object.assign(contents, doc);
393
+ const exception = new models_0_1.VoiceBotNotFoundException({
394
+ $metadata: deserializeMetadata(parsedOutput),
395
+ ...contents
396
+ });
397
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
398
+ };
399
+ const de_VoiceSessionNotFoundExceptionRes = async (parsedOutput, context) => {
400
+ const contents = (0, smithy_client_1.map)({});
401
+ const data = parsedOutput.body;
402
+ const doc = (0, smithy_client_1.take)(data, {
403
+ 'message': smithy_client_1.expectString,
404
+ 'type': smithy_client_1.expectString,
405
+ });
406
+ Object.assign(contents, doc);
407
+ const exception = new models_0_1.VoiceSessionNotFoundException({
408
+ $metadata: deserializeMetadata(parsedOutput),
409
+ ...contents
410
+ });
411
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
412
+ };
413
+ const se_Document = (input, context) => {
414
+ return input;
415
+ };
416
+ const se_BotDialogflowCxEndpoint = (input, context) => {
417
+ return (0, smithy_client_1.take)(input, {
418
+ 'agent': [],
419
+ 'credentials': _ => se_Document(_, context),
420
+ 'language': [],
421
+ 'location': [],
422
+ });
423
+ };
424
+ const se_BotEndpoint = (input, context) => {
425
+ return models_0_1.BotEndpoint.visit(input, {
426
+ dialogflowCx: value => ({ "dialogflowCx": se_BotDialogflowCxEndpoint(value, context) }),
427
+ openAiAssistant: value => ({ "openAiAssistant": (0, smithy_client_1._json)(value) }),
428
+ sqs: value => ({ "sqs": (0, smithy_client_1._json)(value) }),
429
+ webhook: value => ({ "webhook": (0, smithy_client_1._json)(value) }),
430
+ _: (name, value) => ({ name: value })
431
+ });
432
+ };
433
+ const de_Document = (output, context) => {
434
+ return output;
435
+ };
436
+ const de_VoiceBot = (output, context) => {
437
+ return (0, smithy_client_1.take)(output, {
438
+ 'createdAt': smithy_client_1.expectString,
439
+ 'endpoint': (_) => de_BotEndpoint((0, smithy_client_1.expectUnion)(_), context),
440
+ 'id': smithy_client_1.expectString,
441
+ 'languageCode': smithy_client_1.expectString,
442
+ 'maximumDuration': smithy_client_1.expectInt32,
443
+ 'name': smithy_client_1.expectString,
444
+ 'silenceTimeout': smithy_client_1.expectInt32,
445
+ 'updatedAt': smithy_client_1.expectString,
446
+ 'voiceId': smithy_client_1.expectString,
447
+ });
448
+ };
449
+ const de_VoiceBotsList = (output, context) => {
450
+ const retVal = (output || []).filter((e) => e != null).map((entry) => {
451
+ return de_VoiceBot(entry, context);
452
+ });
453
+ return retVal;
454
+ };
455
+ const de_BotDialogflowCxEndpoint = (output, context) => {
456
+ return (0, smithy_client_1.take)(output, {
457
+ 'agent': smithy_client_1.expectString,
458
+ 'credentials': (_) => de_Document(_, context),
459
+ 'language': smithy_client_1.expectString,
460
+ 'location': smithy_client_1.expectString,
461
+ });
462
+ };
463
+ const de_BotEndpoint = (output, context) => {
464
+ if (output.dialogflowCx != null) {
465
+ return {
466
+ dialogflowCx: de_BotDialogflowCxEndpoint(output.dialogflowCx, context)
467
+ };
468
+ }
469
+ if (output.openAiAssistant != null) {
470
+ return {
471
+ openAiAssistant: (0, smithy_client_1._json)(output.openAiAssistant)
472
+ };
473
+ }
474
+ if (output.sqs != null) {
475
+ return {
476
+ sqs: (0, smithy_client_1._json)(output.sqs)
477
+ };
478
+ }
479
+ if (output.webhook != null) {
480
+ return {
481
+ webhook: (0, smithy_client_1._json)(output.webhook)
482
+ };
483
+ }
484
+ return { $unknown: Object.entries(output)[0] };
485
+ };
486
+ const deserializeMetadata = (output) => ({
487
+ httpStatusCode: output.statusCode,
488
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
489
+ extendedRequestId: output.headers["x-amz-id-2"],
490
+ cfId: output.headers["x-amz-cf-id"],
491
+ });
492
+ const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then(body => context.utf8Encoder(body));
493
+ const isSerializableHeaderValue = (value) => value !== undefined &&
494
+ value !== null &&
495
+ value !== "" &&
496
+ (!Object.getOwnPropertyNames(value).includes("length") ||
497
+ value.length != 0) &&
498
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
499
+ const _c = "company";
500
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then(encoded => {
501
+ if (encoded.length) {
502
+ return JSON.parse(encoded);
503
+ }
504
+ return {};
505
+ });
506
+ const parseErrorBody = async (errorBody, context) => {
507
+ const value = await parseBody(errorBody, context);
508
+ value.message = value.message ?? value.Message;
509
+ return value;
510
+ };
511
+ const loadRestJsonErrorCode = (output, data) => {
512
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
513
+ const sanitizeErrorCode = (rawValue) => {
514
+ let cleanValue = rawValue;
515
+ if (typeof cleanValue === "number") {
516
+ cleanValue = cleanValue.toString();
517
+ }
518
+ if (cleanValue.indexOf(",") >= 0) {
519
+ cleanValue = cleanValue.split(",")[0];
520
+ }
521
+ if (cleanValue.indexOf(":") >= 0) {
522
+ cleanValue = cleanValue.split(":")[0];
523
+ }
524
+ if (cleanValue.indexOf("#") >= 0) {
525
+ cleanValue = cleanValue.split("#")[1];
526
+ }
527
+ return cleanValue;
528
+ };
529
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
530
+ if (headerKey !== undefined) {
531
+ return sanitizeErrorCode(output.headers[headerKey]);
532
+ }
533
+ if (data.code !== undefined) {
534
+ return sanitizeErrorCode(data.code);
535
+ }
536
+ if (data["__type"] !== undefined) {
537
+ return sanitizeErrorCode(data["__type"]);
538
+ }
539
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
6
+ const sha256_browser_1 = require("@aws-crypto/sha256-browser");
7
+ const util_user_agent_browser_1 = require("@aws-sdk/util-user-agent-browser");
8
+ const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
9
+ const util_body_length_browser_1 = require("@smithy/util-body-length-browser");
10
+ const util_retry_1 = require("@smithy/util-retry");
11
+ const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
12
+ const smithy_client_1 = require("@smithy/smithy-client");
13
+ const util_defaults_mode_browser_1 = require("@smithy/util-defaults-mode-browser");
14
+ const getRuntimeConfig = (config) => {
15
+ const defaultsMode = (0, util_defaults_mode_browser_1.resolveDefaultsModeConfig)(config);
16
+ const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
17
+ const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
18
+ return {
19
+ ...clientSharedValues,
20
+ ...config,
21
+ runtime: "browser",
22
+ defaultsMode,
23
+ bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_browser_1.calculateBodyLength,
24
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_browser_1.defaultUserAgent)({ serviceId: package_json_1.default.name, clientVersion: package_json_1.default.version }),
25
+ maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
26
+ requestHandler: fetch_http_handler_1.FetchHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
27
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
28
+ sha256: config?.sha256 ?? sha256_browser_1.Sha256,
29
+ streamCollector: config?.streamCollector ?? fetch_http_handler_1.streamCollector,
30
+ };
31
+ };
32
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
6
+ const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
7
+ const hash_node_1 = require("@smithy/hash-node");
8
+ const middleware_retry_1 = require("@smithy/middleware-retry");
9
+ const node_config_provider_1 = require("@smithy/node-config-provider");
10
+ const node_http_handler_1 = require("@smithy/node-http-handler");
11
+ const util_body_length_node_1 = require("@smithy/util-body-length-node");
12
+ const util_retry_1 = require("@smithy/util-retry");
13
+ const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
14
+ const smithy_client_1 = require("@smithy/smithy-client");
15
+ const util_defaults_mode_node_1 = require("@smithy/util-defaults-mode-node");
16
+ const smithy_client_2 = require("@smithy/smithy-client");
17
+ const getRuntimeConfig = (config) => {
18
+ (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version);
19
+ const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
20
+ const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
21
+ const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
22
+ return {
23
+ ...clientSharedValues,
24
+ ...config,
25
+ runtime: "node",
26
+ defaultsMode,
27
+ bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
28
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: package_json_1.default.name, clientVersion: package_json_1.default.version }),
29
+ maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
30
+ requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
31
+ retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE, }),
32
+ sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
33
+ streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
34
+ };
35
+ };
36
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const sha256_js_1 = require("@aws-crypto/sha256-js");
5
+ const runtimeConfig_browser_1 = require("./runtimeConfig.browser");
6
+ const getRuntimeConfig = (config) => {
7
+ const browserDefaults = (0, runtimeConfig_browser_1.getRuntimeConfig)(config);
8
+ return {
9
+ ...browserDefaults,
10
+ ...config,
11
+ runtime: "react-native",
12
+ sha256: config?.sha256 ?? sha256_js_1.Sha256,
13
+ };
14
+ };
15
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const smithy_client_1 = require("@smithy/smithy-client");
5
+ const url_parser_1 = require("@smithy/url-parser");
6
+ const util_base64_1 = require("@smithy/util-base64");
7
+ const util_utf8_1 = require("@smithy/util-utf8");
8
+ const getRuntimeConfig = (config) => {
9
+ return {
10
+ apiVersion: "v2",
11
+ base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
12
+ base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
13
+ disableHostPrefix: config?.disableHostPrefix ?? false,
14
+ extensions: config?.extensions ?? [],
15
+ logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
16
+ urlParser: config?.urlParser ?? url_parser_1.parseUrl,
17
+ utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
18
+ utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
19
+ };
20
+ };
21
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveRuntimeExtensions = void 0;
4
+ const protocol_http_1 = require("@smithy/protocol-http");
5
+ const smithy_client_1 = require("@smithy/smithy-client");
6
+ const asPartial = (t) => t;
7
+ const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
8
+ const extensionConfiguration = {
9
+ ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)),
10
+ ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
11
+ };
12
+ extensions.forEach(extension => extension.configure(extensionConfiguration));
13
+ return {
14
+ ...runtimeConfig,
15
+ ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration),
16
+ ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
17
+ };
18
+ };
19
+ exports.resolveRuntimeExtensions = resolveRuntimeExtensions;