@wildix/xbees-conversations-client 1.0.18

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 (67) hide show
  1. package/dist-cjs/Conversations.js +27 -0
  2. package/dist-cjs/ConversationsClient.js +33 -0
  3. package/dist-cjs/commands/CreateChannelCommand.js +41 -0
  4. package/dist-cjs/commands/CreateMessageCommand.js +41 -0
  5. package/dist-cjs/commands/DeleteChannelCommand.js +41 -0
  6. package/dist-cjs/commands/GetChannelCommand.js +41 -0
  7. package/dist-cjs/commands/GetChannelMemberCommand.js +41 -0
  8. package/dist-cjs/commands/GetMessageCommand.js +41 -0
  9. package/dist-cjs/commands/PartialUpdateChannelCommand.js +41 -0
  10. package/dist-cjs/commands/UpdateChannelCommand.js +41 -0
  11. package/dist-cjs/commands/index.js +11 -0
  12. package/dist-cjs/extensionConfiguration.js +2 -0
  13. package/dist-cjs/index.js +10 -0
  14. package/dist-cjs/models/ConversationsServiceException.js +12 -0
  15. package/dist-cjs/models/index.js +4 -0
  16. package/dist-cjs/models/models_0.js +96 -0
  17. package/dist-cjs/protocols/Aws_restJson1.js +597 -0
  18. package/dist-cjs/runtimeConfig.browser.js +28 -0
  19. package/dist-cjs/runtimeConfig.js +32 -0
  20. package/dist-cjs/runtimeConfig.native.js +15 -0
  21. package/dist-cjs/runtimeConfig.shared.js +19 -0
  22. package/dist-cjs/runtimeExtensions.js +19 -0
  23. package/dist-es/Conversations.js +23 -0
  24. package/dist-es/ConversationsClient.js +29 -0
  25. package/dist-es/commands/CreateChannelCommand.js +37 -0
  26. package/dist-es/commands/CreateMessageCommand.js +37 -0
  27. package/dist-es/commands/DeleteChannelCommand.js +37 -0
  28. package/dist-es/commands/GetChannelCommand.js +37 -0
  29. package/dist-es/commands/GetChannelMemberCommand.js +37 -0
  30. package/dist-es/commands/GetMessageCommand.js +37 -0
  31. package/dist-es/commands/PartialUpdateChannelCommand.js +37 -0
  32. package/dist-es/commands/UpdateChannelCommand.js +37 -0
  33. package/dist-es/commands/index.js +8 -0
  34. package/dist-es/extensionConfiguration.js +1 -0
  35. package/dist-es/index.js +5 -0
  36. package/dist-es/models/ConversationsServiceException.js +8 -0
  37. package/dist-es/models/index.js +1 -0
  38. package/dist-es/models/models_0.js +90 -0
  39. package/dist-es/protocols/Aws_restJson1.js +578 -0
  40. package/dist-es/runtimeConfig.browser.js +24 -0
  41. package/dist-es/runtimeConfig.js +28 -0
  42. package/dist-es/runtimeConfig.native.js +11 -0
  43. package/dist-es/runtimeConfig.shared.js +15 -0
  44. package/dist-es/runtimeExtensions.js +15 -0
  45. package/dist-types/Conversations.d.ts +65 -0
  46. package/dist-types/ConversationsClient.d.ts +144 -0
  47. package/dist-types/commands/CreateChannelCommand.d.ts +194 -0
  48. package/dist-types/commands/CreateMessageCommand.d.ts +360 -0
  49. package/dist-types/commands/DeleteChannelCommand.d.ts +71 -0
  50. package/dist-types/commands/GetChannelCommand.d.ts +136 -0
  51. package/dist-types/commands/GetChannelMemberCommand.d.ts +80 -0
  52. package/dist-types/commands/GetMessageCommand.d.ts +209 -0
  53. package/dist-types/commands/PartialUpdateChannelCommand.d.ts +193 -0
  54. package/dist-types/commands/UpdateChannelCommand.d.ts +190 -0
  55. package/dist-types/commands/index.d.ts +8 -0
  56. package/dist-types/extensionConfiguration.d.ts +7 -0
  57. package/dist-types/index.d.ts +5 -0
  58. package/dist-types/models/ConversationsServiceException.d.ts +13 -0
  59. package/dist-types/models/index.d.ts +1 -0
  60. package/dist-types/models/models_0.d.ts +508 -0
  61. package/dist-types/protocols/Aws_restJson1.d.ts +74 -0
  62. package/dist-types/runtimeConfig.browser.d.ts +29 -0
  63. package/dist-types/runtimeConfig.d.ts +29 -0
  64. package/dist-types/runtimeConfig.native.d.ts +28 -0
  65. package/dist-types/runtimeConfig.shared.d.ts +15 -0
  66. package/dist-types/runtimeExtensions.d.ts +17 -0
  67. package/package.json +77 -0
@@ -0,0 +1,597 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.de_UpdateChannelCommand = exports.de_PartialUpdateChannelCommand = exports.de_GetMessageCommand = exports.de_GetChannelMemberCommand = exports.de_GetChannelCommand = exports.de_DeleteChannelCommand = exports.de_CreateMessageCommand = exports.de_CreateChannelCommand = exports.se_UpdateChannelCommand = exports.se_PartialUpdateChannelCommand = exports.se_GetMessageCommand = exports.se_GetChannelMemberCommand = exports.se_GetChannelCommand = exports.se_DeleteChannelCommand = exports.se_CreateMessageCommand = exports.se_CreateChannelCommand = void 0;
4
+ const ConversationsServiceException_1 = require("../models/ConversationsServiceException");
5
+ const models_0_1 = require("../models/models_0");
6
+ const protocol_http_1 = require("@smithy/protocol-http");
7
+ const smithy_client_1 = require("@smithy/smithy-client");
8
+ const se_CreateChannelCommand = async (input, context) => {
9
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
+ const headers = {
11
+ 'content-type': 'application/json',
12
+ };
13
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/conversations";
14
+ let body;
15
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
16
+ 'channel': _ => (0, smithy_client_1._json)(_),
17
+ }));
18
+ return new protocol_http_1.HttpRequest({
19
+ protocol,
20
+ hostname,
21
+ port,
22
+ method: "POST",
23
+ headers,
24
+ path: resolvedPath,
25
+ body,
26
+ });
27
+ };
28
+ exports.se_CreateChannelCommand = se_CreateChannelCommand;
29
+ const se_CreateMessageCommand = async (input, context) => {
30
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
31
+ const headers = {
32
+ 'content-type': 'application/json',
33
+ };
34
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/conversations/{channelId}/messages";
35
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, 'channelId', () => input.channelId, '{channelId}', false);
36
+ const query = (0, smithy_client_1.map)({
37
+ "user_id": [, (0, smithy_client_1.expectNonNull)(input.userId, `userId`)],
38
+ });
39
+ let body;
40
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
41
+ 'message': _ => se_MessageCreateFields(_, context),
42
+ }));
43
+ return new protocol_http_1.HttpRequest({
44
+ protocol,
45
+ hostname,
46
+ port,
47
+ method: "POST",
48
+ headers,
49
+ path: resolvedPath,
50
+ query,
51
+ body,
52
+ });
53
+ };
54
+ exports.se_CreateMessageCommand = se_CreateMessageCommand;
55
+ const se_DeleteChannelCommand = async (input, context) => {
56
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
57
+ const headers = {};
58
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/conversations/{channelId}";
59
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, 'channelId', () => input.channelId, '{channelId}', false);
60
+ let body;
61
+ return new protocol_http_1.HttpRequest({
62
+ protocol,
63
+ hostname,
64
+ port,
65
+ method: "DELETE",
66
+ headers,
67
+ path: resolvedPath,
68
+ body,
69
+ });
70
+ };
71
+ exports.se_DeleteChannelCommand = se_DeleteChannelCommand;
72
+ const se_GetChannelCommand = async (input, context) => {
73
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
74
+ const headers = {};
75
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/conversations/{channelId}";
76
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, 'channelId', () => input.channelId, '{channelId}', false);
77
+ let body;
78
+ return new protocol_http_1.HttpRequest({
79
+ protocol,
80
+ hostname,
81
+ port,
82
+ method: "GET",
83
+ headers,
84
+ path: resolvedPath,
85
+ body,
86
+ });
87
+ };
88
+ exports.se_GetChannelCommand = se_GetChannelCommand;
89
+ const se_GetChannelMemberCommand = async (input, context) => {
90
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
91
+ const headers = {};
92
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/conversations/{channelId}/members/{memberId}";
93
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, 'channelId', () => input.channelId, '{channelId}', false);
94
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, 'memberId', () => input.memberId, '{memberId}', false);
95
+ let body;
96
+ return new protocol_http_1.HttpRequest({
97
+ protocol,
98
+ hostname,
99
+ port,
100
+ method: "GET",
101
+ headers,
102
+ path: resolvedPath,
103
+ body,
104
+ });
105
+ };
106
+ exports.se_GetChannelMemberCommand = se_GetChannelMemberCommand;
107
+ const se_GetMessageCommand = async (input, context) => {
108
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
109
+ const headers = {};
110
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/conversations/{channelId}/messages";
111
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, 'channelId', () => input.channelId, '{channelId}', false);
112
+ let body;
113
+ return new protocol_http_1.HttpRequest({
114
+ protocol,
115
+ hostname,
116
+ port,
117
+ method: "GET",
118
+ headers,
119
+ path: resolvedPath,
120
+ body,
121
+ });
122
+ };
123
+ exports.se_GetMessageCommand = se_GetMessageCommand;
124
+ const se_PartialUpdateChannelCommand = async (input, context) => {
125
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
126
+ const headers = {
127
+ 'content-type': 'application/json',
128
+ };
129
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/conversations/{channelId}";
130
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, 'channelId', () => input.channelId, '{channelId}', false);
131
+ let body;
132
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
133
+ 'set': _ => (0, smithy_client_1._json)(_),
134
+ 'unset': _ => (0, smithy_client_1._json)(_),
135
+ }));
136
+ return new protocol_http_1.HttpRequest({
137
+ protocol,
138
+ hostname,
139
+ port,
140
+ method: "PATCH",
141
+ headers,
142
+ path: resolvedPath,
143
+ body,
144
+ });
145
+ };
146
+ exports.se_PartialUpdateChannelCommand = se_PartialUpdateChannelCommand;
147
+ const se_UpdateChannelCommand = async (input, context) => {
148
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
149
+ const headers = {
150
+ 'content-type': 'application/json',
151
+ };
152
+ let resolvedPath = `${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}` + "/v2/conversations/{channelId}";
153
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, 'channelId', () => input.channelId, '{channelId}', false);
154
+ let body;
155
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
156
+ 'channel': _ => (0, smithy_client_1._json)(_),
157
+ }));
158
+ return new protocol_http_1.HttpRequest({
159
+ protocol,
160
+ hostname,
161
+ port,
162
+ method: "PUT",
163
+ headers,
164
+ path: resolvedPath,
165
+ body,
166
+ });
167
+ };
168
+ exports.se_UpdateChannelCommand = se_UpdateChannelCommand;
169
+ const de_CreateChannelCommand = async (output, context) => {
170
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
171
+ return de_CreateChannelCommandError(output, context);
172
+ }
173
+ const contents = (0, smithy_client_1.map)({
174
+ $metadata: deserializeMetadata(output),
175
+ });
176
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
177
+ const doc = (0, smithy_client_1.take)(data, {
178
+ 'channel': smithy_client_1._json,
179
+ });
180
+ Object.assign(contents, doc);
181
+ return contents;
182
+ };
183
+ exports.de_CreateChannelCommand = de_CreateChannelCommand;
184
+ const de_CreateChannelCommandError = async (output, context) => {
185
+ const parsedOutput = {
186
+ ...output,
187
+ body: await parseErrorBody(output.body, context)
188
+ };
189
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
190
+ switch (errorCode) {
191
+ case "ValidationException":
192
+ case "smithy.framework#ValidationException":
193
+ throw await de_ValidationExceptionRes(parsedOutput, context);
194
+ default:
195
+ const parsedBody = parsedOutput.body;
196
+ return throwDefaultError({
197
+ output,
198
+ parsedBody,
199
+ errorCode
200
+ });
201
+ }
202
+ };
203
+ const de_CreateMessageCommand = async (output, context) => {
204
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
205
+ return de_CreateMessageCommandError(output, context);
206
+ }
207
+ const contents = (0, smithy_client_1.map)({
208
+ $metadata: deserializeMetadata(output),
209
+ });
210
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
211
+ const doc = (0, smithy_client_1.take)(data, {
212
+ 'message': _ => de_Message(_, context),
213
+ });
214
+ Object.assign(contents, doc);
215
+ return contents;
216
+ };
217
+ exports.de_CreateMessageCommand = de_CreateMessageCommand;
218
+ const de_CreateMessageCommandError = async (output, context) => {
219
+ const parsedOutput = {
220
+ ...output,
221
+ body: await parseErrorBody(output.body, context)
222
+ };
223
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
224
+ switch (errorCode) {
225
+ case "ChannelNotFoundException":
226
+ case "wildix.xbees.conversations#ChannelNotFoundException":
227
+ throw await de_ChannelNotFoundExceptionRes(parsedOutput, context);
228
+ case "ValidationException":
229
+ case "smithy.framework#ValidationException":
230
+ throw await de_ValidationExceptionRes(parsedOutput, context);
231
+ default:
232
+ const parsedBody = parsedOutput.body;
233
+ return throwDefaultError({
234
+ output,
235
+ parsedBody,
236
+ errorCode
237
+ });
238
+ }
239
+ };
240
+ const de_DeleteChannelCommand = async (output, context) => {
241
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
242
+ return de_DeleteChannelCommandError(output, context);
243
+ }
244
+ const contents = (0, smithy_client_1.map)({
245
+ $metadata: deserializeMetadata(output),
246
+ });
247
+ await (0, smithy_client_1.collectBody)(output.body, context);
248
+ return contents;
249
+ };
250
+ exports.de_DeleteChannelCommand = de_DeleteChannelCommand;
251
+ const de_DeleteChannelCommandError = async (output, context) => {
252
+ const parsedOutput = {
253
+ ...output,
254
+ body: await parseErrorBody(output.body, context)
255
+ };
256
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
257
+ switch (errorCode) {
258
+ case "ValidationException":
259
+ case "smithy.framework#ValidationException":
260
+ throw await de_ValidationExceptionRes(parsedOutput, context);
261
+ default:
262
+ const parsedBody = parsedOutput.body;
263
+ return throwDefaultError({
264
+ output,
265
+ parsedBody,
266
+ errorCode
267
+ });
268
+ }
269
+ };
270
+ const de_GetChannelCommand = async (output, context) => {
271
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
272
+ return de_GetChannelCommandError(output, context);
273
+ }
274
+ const contents = (0, smithy_client_1.map)({
275
+ $metadata: deserializeMetadata(output),
276
+ });
277
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
278
+ const doc = (0, smithy_client_1.take)(data, {
279
+ 'channel': smithy_client_1._json,
280
+ });
281
+ Object.assign(contents, doc);
282
+ return contents;
283
+ };
284
+ exports.de_GetChannelCommand = de_GetChannelCommand;
285
+ const de_GetChannelCommandError = async (output, context) => {
286
+ const parsedOutput = {
287
+ ...output,
288
+ body: await parseErrorBody(output.body, context)
289
+ };
290
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
291
+ switch (errorCode) {
292
+ case "ChannelNotFoundException":
293
+ case "wildix.xbees.conversations#ChannelNotFoundException":
294
+ throw await de_ChannelNotFoundExceptionRes(parsedOutput, context);
295
+ case "ValidationException":
296
+ case "smithy.framework#ValidationException":
297
+ throw await de_ValidationExceptionRes(parsedOutput, context);
298
+ default:
299
+ const parsedBody = parsedOutput.body;
300
+ return throwDefaultError({
301
+ output,
302
+ parsedBody,
303
+ errorCode
304
+ });
305
+ }
306
+ };
307
+ const de_GetChannelMemberCommand = async (output, context) => {
308
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
309
+ return de_GetChannelMemberCommandError(output, context);
310
+ }
311
+ const contents = (0, smithy_client_1.map)({
312
+ $metadata: deserializeMetadata(output),
313
+ });
314
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
315
+ const doc = (0, smithy_client_1.take)(data, {
316
+ 'member': smithy_client_1._json,
317
+ });
318
+ Object.assign(contents, doc);
319
+ return contents;
320
+ };
321
+ exports.de_GetChannelMemberCommand = de_GetChannelMemberCommand;
322
+ const de_GetChannelMemberCommandError = async (output, context) => {
323
+ const parsedOutput = {
324
+ ...output,
325
+ body: await parseErrorBody(output.body, context)
326
+ };
327
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
328
+ switch (errorCode) {
329
+ case "MemberNotFoundException":
330
+ case "wildix.xbees.conversations#MemberNotFoundException":
331
+ throw await de_MemberNotFoundExceptionRes(parsedOutput, context);
332
+ case "ValidationException":
333
+ case "smithy.framework#ValidationException":
334
+ throw await de_ValidationExceptionRes(parsedOutput, context);
335
+ default:
336
+ const parsedBody = parsedOutput.body;
337
+ return throwDefaultError({
338
+ output,
339
+ parsedBody,
340
+ errorCode
341
+ });
342
+ }
343
+ };
344
+ const de_GetMessageCommand = async (output, context) => {
345
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
346
+ return de_GetMessageCommandError(output, context);
347
+ }
348
+ const contents = (0, smithy_client_1.map)({
349
+ $metadata: deserializeMetadata(output),
350
+ });
351
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
352
+ const doc = (0, smithy_client_1.take)(data, {
353
+ 'message': _ => de_Message(_, context),
354
+ });
355
+ Object.assign(contents, doc);
356
+ return contents;
357
+ };
358
+ exports.de_GetMessageCommand = de_GetMessageCommand;
359
+ const de_GetMessageCommandError = async (output, context) => {
360
+ const parsedOutput = {
361
+ ...output,
362
+ body: await parseErrorBody(output.body, context)
363
+ };
364
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
365
+ switch (errorCode) {
366
+ case "ChannelNotFoundException":
367
+ case "wildix.xbees.conversations#ChannelNotFoundException":
368
+ throw await de_ChannelNotFoundExceptionRes(parsedOutput, context);
369
+ case "ValidationException":
370
+ case "smithy.framework#ValidationException":
371
+ throw await de_ValidationExceptionRes(parsedOutput, context);
372
+ default:
373
+ const parsedBody = parsedOutput.body;
374
+ return throwDefaultError({
375
+ output,
376
+ parsedBody,
377
+ errorCode
378
+ });
379
+ }
380
+ };
381
+ const de_PartialUpdateChannelCommand = async (output, context) => {
382
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
383
+ return de_PartialUpdateChannelCommandError(output, context);
384
+ }
385
+ const contents = (0, smithy_client_1.map)({
386
+ $metadata: deserializeMetadata(output),
387
+ });
388
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
389
+ const doc = (0, smithy_client_1.take)(data, {
390
+ 'channel': smithy_client_1._json,
391
+ });
392
+ Object.assign(contents, doc);
393
+ return contents;
394
+ };
395
+ exports.de_PartialUpdateChannelCommand = de_PartialUpdateChannelCommand;
396
+ const de_PartialUpdateChannelCommandError = async (output, context) => {
397
+ const parsedOutput = {
398
+ ...output,
399
+ body: await parseErrorBody(output.body, context)
400
+ };
401
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
402
+ switch (errorCode) {
403
+ case "ValidationException":
404
+ case "smithy.framework#ValidationException":
405
+ throw await de_ValidationExceptionRes(parsedOutput, context);
406
+ default:
407
+ const parsedBody = parsedOutput.body;
408
+ return throwDefaultError({
409
+ output,
410
+ parsedBody,
411
+ errorCode
412
+ });
413
+ }
414
+ };
415
+ const de_UpdateChannelCommand = async (output, context) => {
416
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
417
+ return de_UpdateChannelCommandError(output, context);
418
+ }
419
+ const contents = (0, smithy_client_1.map)({
420
+ $metadata: deserializeMetadata(output),
421
+ });
422
+ const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await parseBody(output.body, context))), "body");
423
+ const doc = (0, smithy_client_1.take)(data, {
424
+ 'channel': smithy_client_1._json,
425
+ });
426
+ Object.assign(contents, doc);
427
+ return contents;
428
+ };
429
+ exports.de_UpdateChannelCommand = de_UpdateChannelCommand;
430
+ const de_UpdateChannelCommandError = async (output, context) => {
431
+ const parsedOutput = {
432
+ ...output,
433
+ body: await parseErrorBody(output.body, context)
434
+ };
435
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
436
+ switch (errorCode) {
437
+ case "ValidationException":
438
+ case "smithy.framework#ValidationException":
439
+ throw await de_ValidationExceptionRes(parsedOutput, context);
440
+ default:
441
+ const parsedBody = parsedOutput.body;
442
+ return throwDefaultError({
443
+ output,
444
+ parsedBody,
445
+ errorCode
446
+ });
447
+ }
448
+ };
449
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(ConversationsServiceException_1.ConversationsServiceException);
450
+ const de_ValidationExceptionRes = async (parsedOutput, context) => {
451
+ const contents = (0, smithy_client_1.map)({});
452
+ const data = parsedOutput.body;
453
+ const doc = (0, smithy_client_1.take)(data, {});
454
+ Object.assign(contents, doc);
455
+ const exception = new models_0_1.ValidationException({
456
+ $metadata: deserializeMetadata(parsedOutput),
457
+ ...contents
458
+ });
459
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
460
+ };
461
+ const de_ChannelNotFoundExceptionRes = async (parsedOutput, context) => {
462
+ const contents = (0, smithy_client_1.map)({});
463
+ const data = parsedOutput.body;
464
+ const doc = (0, smithy_client_1.take)(data, {});
465
+ Object.assign(contents, doc);
466
+ const exception = new models_0_1.ChannelNotFoundException({
467
+ $metadata: deserializeMetadata(parsedOutput),
468
+ ...contents
469
+ });
470
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
471
+ };
472
+ const de_MemberNotFoundExceptionRes = async (parsedOutput, context) => {
473
+ const contents = (0, smithy_client_1.map)({});
474
+ const data = parsedOutput.body;
475
+ const doc = (0, smithy_client_1.take)(data, {});
476
+ Object.assign(contents, doc);
477
+ const exception = new models_0_1.MemberNotFoundException({
478
+ $metadata: deserializeMetadata(parsedOutput),
479
+ ...contents
480
+ });
481
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
482
+ };
483
+ const se_Message = (input, context) => {
484
+ return (0, smithy_client_1.take)(input, {
485
+ 'attachments': smithy_client_1._json,
486
+ 'channelId': [],
487
+ 'createdAt': [],
488
+ 'edit': [],
489
+ 'event': [],
490
+ 'forward': smithy_client_1._json,
491
+ 'giphy': smithy_client_1._json,
492
+ 'latestReactions': smithy_client_1._json,
493
+ 'mentions': smithy_client_1._json,
494
+ 'messageId': [],
495
+ 'quote': _ => se_Message(_, context),
496
+ 'reactionCounts': smithy_client_1._json,
497
+ 'silent': [],
498
+ 'sms': [],
499
+ 'smsStatus': [],
500
+ 'text': [],
501
+ 'type': [],
502
+ 'updatedAt': [],
503
+ 'user': smithy_client_1._json,
504
+ });
505
+ };
506
+ const se_MessageCreateFields = (input, context) => {
507
+ return (0, smithy_client_1.take)(input, {
508
+ 'attachments': smithy_client_1._json,
509
+ 'event': [],
510
+ 'forward': smithy_client_1._json,
511
+ 'giphy': smithy_client_1._json,
512
+ 'mentions': smithy_client_1._json,
513
+ 'messageId': [],
514
+ 'quote': _ => se_Message(_, context),
515
+ 'silent': [],
516
+ 'sms': [],
517
+ 'smsStatus': [],
518
+ 'text': [],
519
+ 'type': [],
520
+ });
521
+ };
522
+ const de_Message = (output, context) => {
523
+ return (0, smithy_client_1.take)(output, {
524
+ 'attachments': smithy_client_1._json,
525
+ 'channelId': smithy_client_1.expectString,
526
+ 'createdAt': smithy_client_1.expectString,
527
+ 'edit': smithy_client_1.expectBoolean,
528
+ 'event': smithy_client_1.expectString,
529
+ 'forward': smithy_client_1._json,
530
+ 'giphy': smithy_client_1._json,
531
+ 'latestReactions': smithy_client_1._json,
532
+ 'mentions': smithy_client_1._json,
533
+ 'messageId': smithy_client_1.expectString,
534
+ 'quote': (_) => de_Message(_, context),
535
+ 'reactionCounts': smithy_client_1._json,
536
+ 'silent': smithy_client_1.expectBoolean,
537
+ 'sms': smithy_client_1.expectBoolean,
538
+ 'smsStatus': smithy_client_1.expectString,
539
+ 'text': smithy_client_1.expectString,
540
+ 'type': smithy_client_1.expectString,
541
+ 'updatedAt': smithy_client_1.expectString,
542
+ 'user': smithy_client_1._json,
543
+ });
544
+ };
545
+ const deserializeMetadata = (output) => ({
546
+ httpStatusCode: output.statusCode,
547
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
548
+ extendedRequestId: output.headers["x-amz-id-2"],
549
+ cfId: output.headers["x-amz-cf-id"],
550
+ });
551
+ const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then(body => context.utf8Encoder(body));
552
+ const isSerializableHeaderValue = (value) => value !== undefined &&
553
+ value !== null &&
554
+ value !== "" &&
555
+ (!Object.getOwnPropertyNames(value).includes("length") ||
556
+ value.length != 0) &&
557
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
558
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then(encoded => {
559
+ if (encoded.length) {
560
+ return JSON.parse(encoded);
561
+ }
562
+ return {};
563
+ });
564
+ const parseErrorBody = async (errorBody, context) => {
565
+ const value = await parseBody(errorBody, context);
566
+ value.message = value.message ?? value.Message;
567
+ return value;
568
+ };
569
+ const loadRestJsonErrorCode = (output, data) => {
570
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
571
+ const sanitizeErrorCode = (rawValue) => {
572
+ let cleanValue = rawValue;
573
+ if (typeof cleanValue === "number") {
574
+ cleanValue = cleanValue.toString();
575
+ }
576
+ if (cleanValue.indexOf(",") >= 0) {
577
+ cleanValue = cleanValue.split(",")[0];
578
+ }
579
+ if (cleanValue.indexOf(":") >= 0) {
580
+ cleanValue = cleanValue.split(":")[0];
581
+ }
582
+ if (cleanValue.indexOf("#") >= 0) {
583
+ cleanValue = cleanValue.split("#")[1];
584
+ }
585
+ return cleanValue;
586
+ };
587
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
588
+ if (headerKey !== undefined) {
589
+ return sanitizeErrorCode(output.headers[headerKey]);
590
+ }
591
+ if (data.code !== undefined) {
592
+ return sanitizeErrorCode(data.code);
593
+ }
594
+ if (data["__type"] !== undefined) {
595
+ return sanitizeErrorCode(data["__type"]);
596
+ }
597
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const sha256_browser_1 = require("@aws-crypto/sha256-browser");
5
+ const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
6
+ const util_body_length_browser_1 = require("@smithy/util-body-length-browser");
7
+ const util_retry_1 = require("@smithy/util-retry");
8
+ const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
9
+ const smithy_client_1 = require("@smithy/smithy-client");
10
+ const util_defaults_mode_browser_1 = require("@smithy/util-defaults-mode-browser");
11
+ const getRuntimeConfig = (config) => {
12
+ const defaultsMode = (0, util_defaults_mode_browser_1.resolveDefaultsModeConfig)(config);
13
+ const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
14
+ const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
15
+ return {
16
+ ...clientSharedValues,
17
+ ...config,
18
+ runtime: "browser",
19
+ defaultsMode,
20
+ bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_browser_1.calculateBodyLength,
21
+ maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
22
+ requestHandler: config?.requestHandler ?? new fetch_http_handler_1.FetchHttpHandler(defaultConfigProvider),
23
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
24
+ sha256: config?.sha256 ?? sha256_browser_1.Sha256,
25
+ streamCollector: config?.streamCollector ?? fetch_http_handler_1.streamCollector,
26
+ };
27
+ };
28
+ exports.getRuntimeConfig = getRuntimeConfig;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const hash_node_1 = require("@smithy/hash-node");
5
+ const middleware_retry_1 = require("@smithy/middleware-retry");
6
+ const node_config_provider_1 = require("@smithy/node-config-provider");
7
+ const node_http_handler_1 = require("@smithy/node-http-handler");
8
+ const util_body_length_node_1 = require("@smithy/util-body-length-node");
9
+ const util_retry_1 = require("@smithy/util-retry");
10
+ const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
11
+ const smithy_client_1 = require("@smithy/smithy-client");
12
+ const util_defaults_mode_node_1 = require("@smithy/util-defaults-mode-node");
13
+ const smithy_client_2 = require("@smithy/smithy-client");
14
+ const getRuntimeConfig = (config) => {
15
+ (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version);
16
+ const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
17
+ const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
18
+ const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
19
+ return {
20
+ ...clientSharedValues,
21
+ ...config,
22
+ runtime: "node",
23
+ defaultsMode,
24
+ bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
25
+ maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
26
+ requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider),
27
+ 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, }),
28
+ sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
29
+ streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
30
+ };
31
+ };
32
+ 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;