@aws-sdk/client-ivschat 3.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +201 -0
  3. package/README.md +374 -0
  4. package/dist-cjs/Ivschat.js +187 -0
  5. package/dist-cjs/IvschatClient.js +35 -0
  6. package/dist-cjs/commands/CreateChatTokenCommand.js +36 -0
  7. package/dist-cjs/commands/CreateRoomCommand.js +36 -0
  8. package/dist-cjs/commands/DeleteMessageCommand.js +36 -0
  9. package/dist-cjs/commands/DeleteRoomCommand.js +36 -0
  10. package/dist-cjs/commands/DisconnectUserCommand.js +36 -0
  11. package/dist-cjs/commands/GetRoomCommand.js +36 -0
  12. package/dist-cjs/commands/ListRoomsCommand.js +36 -0
  13. package/dist-cjs/commands/ListTagsForResourceCommand.js +36 -0
  14. package/dist-cjs/commands/SendEventCommand.js +36 -0
  15. package/dist-cjs/commands/TagResourceCommand.js +36 -0
  16. package/dist-cjs/commands/UntagResourceCommand.js +36 -0
  17. package/dist-cjs/commands/UpdateRoomCommand.js +36 -0
  18. package/dist-cjs/commands/index.js +15 -0
  19. package/dist-cjs/endpoints.js +131 -0
  20. package/dist-cjs/index.js +11 -0
  21. package/dist-cjs/models/IvschatServiceException.js +11 -0
  22. package/dist-cjs/models/index.js +4 -0
  23. package/dist-cjs/models/models_0.js +297 -0
  24. package/dist-cjs/pagination/Interfaces.js +2 -0
  25. package/dist-cjs/pagination/ListRoomsPaginator.js +36 -0
  26. package/dist-cjs/pagination/index.js +5 -0
  27. package/dist-cjs/protocols/Aws_restJson1.js +1253 -0
  28. package/dist-cjs/runtimeConfig.browser.js +45 -0
  29. package/dist-cjs/runtimeConfig.js +50 -0
  30. package/dist-cjs/runtimeConfig.native.js +16 -0
  31. package/dist-cjs/runtimeConfig.shared.js +17 -0
  32. package/dist-es/Ivschat.js +190 -0
  33. package/dist-es/IvschatClient.js +37 -0
  34. package/dist-es/commands/CreateChatTokenCommand.js +39 -0
  35. package/dist-es/commands/CreateRoomCommand.js +39 -0
  36. package/dist-es/commands/DeleteMessageCommand.js +39 -0
  37. package/dist-es/commands/DeleteRoomCommand.js +39 -0
  38. package/dist-es/commands/DisconnectUserCommand.js +39 -0
  39. package/dist-es/commands/GetRoomCommand.js +39 -0
  40. package/dist-es/commands/ListRoomsCommand.js +39 -0
  41. package/dist-es/commands/ListTagsForResourceCommand.js +39 -0
  42. package/dist-es/commands/SendEventCommand.js +39 -0
  43. package/dist-es/commands/TagResourceCommand.js +39 -0
  44. package/dist-es/commands/UntagResourceCommand.js +39 -0
  45. package/dist-es/commands/UpdateRoomCommand.js +39 -0
  46. package/dist-es/commands/index.js +12 -0
  47. package/dist-es/endpoints.js +127 -0
  48. package/dist-es/index.js +6 -0
  49. package/dist-es/models/IvschatServiceException.js +12 -0
  50. package/dist-es/models/index.js +1 -0
  51. package/dist-es/models/models_0.js +235 -0
  52. package/dist-es/pagination/Interfaces.js +1 -0
  53. package/dist-es/pagination/ListRoomsPaginator.js +75 -0
  54. package/dist-es/pagination/index.js +2 -0
  55. package/dist-es/protocols/Aws_restJson1.js +1519 -0
  56. package/dist-es/runtimeConfig.browser.js +26 -0
  57. package/dist-es/runtimeConfig.js +28 -0
  58. package/dist-es/runtimeConfig.native.js +8 -0
  59. package/dist-es/runtimeConfig.shared.js +13 -0
  60. package/dist-types/Ivschat.d.ts +278 -0
  61. package/dist-types/IvschatClient.d.ts +332 -0
  62. package/dist-types/commands/CreateChatTokenCommand.d.ts +39 -0
  63. package/dist-types/commands/CreateRoomCommand.d.ts +35 -0
  64. package/dist-types/commands/DeleteMessageCommand.d.ts +38 -0
  65. package/dist-types/commands/DeleteRoomCommand.d.ts +35 -0
  66. package/dist-types/commands/DisconnectUserCommand.d.ts +36 -0
  67. package/dist-types/commands/GetRoomCommand.d.ts +35 -0
  68. package/dist-types/commands/ListRoomsCommand.d.ts +36 -0
  69. package/dist-types/commands/ListTagsForResourceCommand.d.ts +35 -0
  70. package/dist-types/commands/SendEventCommand.d.ts +37 -0
  71. package/dist-types/commands/TagResourceCommand.d.ts +35 -0
  72. package/dist-types/commands/UntagResourceCommand.d.ts +35 -0
  73. package/dist-types/commands/UpdateRoomCommand.d.ts +35 -0
  74. package/dist-types/commands/index.d.ts +12 -0
  75. package/dist-types/endpoints.d.ts +2 -0
  76. package/dist-types/index.d.ts +6 -0
  77. package/dist-types/models/IvschatServiceException.d.ts +10 -0
  78. package/dist-types/models/index.d.ts +1 -0
  79. package/dist-types/models/models_0.d.ts +762 -0
  80. package/dist-types/pagination/Interfaces.d.ts +6 -0
  81. package/dist-types/pagination/ListRoomsPaginator.d.ts +4 -0
  82. package/dist-types/pagination/index.d.ts +2 -0
  83. package/dist-types/protocols/Aws_restJson1.d.ts +38 -0
  84. package/dist-types/runtimeConfig.browser.d.ts +40 -0
  85. package/dist-types/runtimeConfig.d.ts +40 -0
  86. package/dist-types/runtimeConfig.native.d.ts +39 -0
  87. package/dist-types/runtimeConfig.shared.d.ts +13 -0
  88. package/dist-types/ts3.4/Ivschat.d.ts +65 -0
  89. package/dist-types/ts3.4/IvschatClient.d.ts +85 -0
  90. package/dist-types/ts3.4/commands/CreateChatTokenCommand.d.ts +17 -0
  91. package/dist-types/ts3.4/commands/CreateRoomCommand.d.ts +17 -0
  92. package/dist-types/ts3.4/commands/DeleteMessageCommand.d.ts +17 -0
  93. package/dist-types/ts3.4/commands/DeleteRoomCommand.d.ts +17 -0
  94. package/dist-types/ts3.4/commands/DisconnectUserCommand.d.ts +17 -0
  95. package/dist-types/ts3.4/commands/GetRoomCommand.d.ts +17 -0
  96. package/dist-types/ts3.4/commands/ListRoomsCommand.d.ts +17 -0
  97. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +17 -0
  98. package/dist-types/ts3.4/commands/SendEventCommand.d.ts +17 -0
  99. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +17 -0
  100. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +17 -0
  101. package/dist-types/ts3.4/commands/UpdateRoomCommand.d.ts +17 -0
  102. package/dist-types/ts3.4/commands/index.d.ts +12 -0
  103. package/dist-types/ts3.4/endpoints.d.ts +2 -0
  104. package/dist-types/ts3.4/index.d.ts +6 -0
  105. package/dist-types/ts3.4/models/IvschatServiceException.d.ts +6 -0
  106. package/dist-types/ts3.4/models/index.d.ts +1 -0
  107. package/dist-types/ts3.4/models/models_0.d.ts +438 -0
  108. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  109. package/dist-types/ts3.4/pagination/ListRoomsPaginator.d.ts +4 -0
  110. package/dist-types/ts3.4/pagination/index.d.ts +2 -0
  111. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +38 -0
  112. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +38 -0
  113. package/dist-types/ts3.4/runtimeConfig.d.ts +38 -0
  114. package/dist-types/ts3.4/runtimeConfig.native.d.ts +37 -0
  115. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +11 -0
  116. package/package.json +93 -0
@@ -0,0 +1,1253 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeAws_restJson1UpdateRoomCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1SendEventCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListRoomsCommand = exports.deserializeAws_restJson1GetRoomCommand = exports.deserializeAws_restJson1DisconnectUserCommand = exports.deserializeAws_restJson1DeleteRoomCommand = exports.deserializeAws_restJson1DeleteMessageCommand = exports.deserializeAws_restJson1CreateRoomCommand = exports.deserializeAws_restJson1CreateChatTokenCommand = exports.serializeAws_restJson1UpdateRoomCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1SendEventCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListRoomsCommand = exports.serializeAws_restJson1GetRoomCommand = exports.serializeAws_restJson1DisconnectUserCommand = exports.serializeAws_restJson1DeleteRoomCommand = exports.serializeAws_restJson1DeleteMessageCommand = exports.serializeAws_restJson1CreateRoomCommand = exports.serializeAws_restJson1CreateChatTokenCommand = void 0;
4
+ const protocol_http_1 = require("@aws-sdk/protocol-http");
5
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const IvschatServiceException_1 = require("../models/IvschatServiceException");
7
+ const models_0_1 = require("../models/models_0");
8
+ const serializeAws_restJson1CreateChatTokenCommand = async (input, context) => {
9
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
+ const headers = {
11
+ "content-type": "application/json",
12
+ };
13
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/CreateChatToken";
14
+ let body;
15
+ body = JSON.stringify({
16
+ ...(input.attributes !== undefined &&
17
+ input.attributes !== null && {
18
+ attributes: serializeAws_restJson1ChatTokenAttributes(input.attributes, context),
19
+ }),
20
+ ...(input.capabilities !== undefined &&
21
+ input.capabilities !== null && {
22
+ capabilities: serializeAws_restJson1ChatTokenCapabilities(input.capabilities, context),
23
+ }),
24
+ ...(input.roomIdentifier !== undefined &&
25
+ input.roomIdentifier !== null && { roomIdentifier: input.roomIdentifier }),
26
+ ...(input.sessionDurationInMinutes !== undefined &&
27
+ input.sessionDurationInMinutes !== null && { sessionDurationInMinutes: input.sessionDurationInMinutes }),
28
+ ...(input.userId !== undefined && input.userId !== null && { userId: input.userId }),
29
+ });
30
+ return new protocol_http_1.HttpRequest({
31
+ protocol,
32
+ hostname,
33
+ port,
34
+ method: "POST",
35
+ headers,
36
+ path: resolvedPath,
37
+ body,
38
+ });
39
+ };
40
+ exports.serializeAws_restJson1CreateChatTokenCommand = serializeAws_restJson1CreateChatTokenCommand;
41
+ const serializeAws_restJson1CreateRoomCommand = async (input, context) => {
42
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
43
+ const headers = {
44
+ "content-type": "application/json",
45
+ };
46
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/CreateRoom";
47
+ let body;
48
+ body = JSON.stringify({
49
+ ...(input.maximumMessageLength !== undefined &&
50
+ input.maximumMessageLength !== null && { maximumMessageLength: input.maximumMessageLength }),
51
+ ...(input.maximumMessageRatePerSecond !== undefined &&
52
+ input.maximumMessageRatePerSecond !== null && { maximumMessageRatePerSecond: input.maximumMessageRatePerSecond }),
53
+ ...(input.messageReviewHandler !== undefined &&
54
+ input.messageReviewHandler !== null && {
55
+ messageReviewHandler: serializeAws_restJson1MessageReviewHandler(input.messageReviewHandler, context),
56
+ }),
57
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
58
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
59
+ });
60
+ return new protocol_http_1.HttpRequest({
61
+ protocol,
62
+ hostname,
63
+ port,
64
+ method: "POST",
65
+ headers,
66
+ path: resolvedPath,
67
+ body,
68
+ });
69
+ };
70
+ exports.serializeAws_restJson1CreateRoomCommand = serializeAws_restJson1CreateRoomCommand;
71
+ const serializeAws_restJson1DeleteMessageCommand = async (input, context) => {
72
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
73
+ const headers = {
74
+ "content-type": "application/json",
75
+ };
76
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteMessage";
77
+ let body;
78
+ body = JSON.stringify({
79
+ ...(input.id !== undefined && input.id !== null && { id: input.id }),
80
+ ...(input.reason !== undefined && input.reason !== null && { reason: input.reason }),
81
+ ...(input.roomIdentifier !== undefined &&
82
+ input.roomIdentifier !== null && { roomIdentifier: input.roomIdentifier }),
83
+ });
84
+ return new protocol_http_1.HttpRequest({
85
+ protocol,
86
+ hostname,
87
+ port,
88
+ method: "POST",
89
+ headers,
90
+ path: resolvedPath,
91
+ body,
92
+ });
93
+ };
94
+ exports.serializeAws_restJson1DeleteMessageCommand = serializeAws_restJson1DeleteMessageCommand;
95
+ const serializeAws_restJson1DeleteRoomCommand = async (input, context) => {
96
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
97
+ const headers = {
98
+ "content-type": "application/json",
99
+ };
100
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteRoom";
101
+ let body;
102
+ body = JSON.stringify({
103
+ ...(input.identifier !== undefined && input.identifier !== null && { identifier: input.identifier }),
104
+ });
105
+ return new protocol_http_1.HttpRequest({
106
+ protocol,
107
+ hostname,
108
+ port,
109
+ method: "POST",
110
+ headers,
111
+ path: resolvedPath,
112
+ body,
113
+ });
114
+ };
115
+ exports.serializeAws_restJson1DeleteRoomCommand = serializeAws_restJson1DeleteRoomCommand;
116
+ const serializeAws_restJson1DisconnectUserCommand = async (input, context) => {
117
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
118
+ const headers = {
119
+ "content-type": "application/json",
120
+ };
121
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/DisconnectUser";
122
+ let body;
123
+ body = JSON.stringify({
124
+ ...(input.reason !== undefined && input.reason !== null && { reason: input.reason }),
125
+ ...(input.roomIdentifier !== undefined &&
126
+ input.roomIdentifier !== null && { roomIdentifier: input.roomIdentifier }),
127
+ ...(input.userId !== undefined && input.userId !== null && { userId: input.userId }),
128
+ });
129
+ return new protocol_http_1.HttpRequest({
130
+ protocol,
131
+ hostname,
132
+ port,
133
+ method: "POST",
134
+ headers,
135
+ path: resolvedPath,
136
+ body,
137
+ });
138
+ };
139
+ exports.serializeAws_restJson1DisconnectUserCommand = serializeAws_restJson1DisconnectUserCommand;
140
+ const serializeAws_restJson1GetRoomCommand = async (input, context) => {
141
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
142
+ const headers = {
143
+ "content-type": "application/json",
144
+ };
145
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/GetRoom";
146
+ let body;
147
+ body = JSON.stringify({
148
+ ...(input.identifier !== undefined && input.identifier !== null && { identifier: input.identifier }),
149
+ });
150
+ return new protocol_http_1.HttpRequest({
151
+ protocol,
152
+ hostname,
153
+ port,
154
+ method: "POST",
155
+ headers,
156
+ path: resolvedPath,
157
+ body,
158
+ });
159
+ };
160
+ exports.serializeAws_restJson1GetRoomCommand = serializeAws_restJson1GetRoomCommand;
161
+ const serializeAws_restJson1ListRoomsCommand = async (input, context) => {
162
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
163
+ const headers = {
164
+ "content-type": "application/json",
165
+ };
166
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/ListRooms";
167
+ let body;
168
+ body = JSON.stringify({
169
+ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }),
170
+ ...(input.messageReviewHandlerUri !== undefined &&
171
+ input.messageReviewHandlerUri !== null && { messageReviewHandlerUri: input.messageReviewHandlerUri }),
172
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
173
+ ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }),
174
+ });
175
+ return new protocol_http_1.HttpRequest({
176
+ protocol,
177
+ hostname,
178
+ port,
179
+ method: "POST",
180
+ headers,
181
+ path: resolvedPath,
182
+ body,
183
+ });
184
+ };
185
+ exports.serializeAws_restJson1ListRoomsCommand = serializeAws_restJson1ListRoomsCommand;
186
+ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context) => {
187
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
188
+ const headers = {};
189
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
190
+ if (input.resourceArn !== undefined) {
191
+ const labelValue = input.resourceArn;
192
+ if (labelValue.length <= 0) {
193
+ throw new Error("Empty value provided for input HTTP label: resourceArn.");
194
+ }
195
+ resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
196
+ }
197
+ else {
198
+ throw new Error("No value provided for input HTTP label: resourceArn.");
199
+ }
200
+ let body;
201
+ return new protocol_http_1.HttpRequest({
202
+ protocol,
203
+ hostname,
204
+ port,
205
+ method: "GET",
206
+ headers,
207
+ path: resolvedPath,
208
+ body,
209
+ });
210
+ };
211
+ exports.serializeAws_restJson1ListTagsForResourceCommand = serializeAws_restJson1ListTagsForResourceCommand;
212
+ const serializeAws_restJson1SendEventCommand = async (input, context) => {
213
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
214
+ const headers = {
215
+ "content-type": "application/json",
216
+ };
217
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/SendEvent";
218
+ let body;
219
+ body = JSON.stringify({
220
+ ...(input.attributes !== undefined &&
221
+ input.attributes !== null && { attributes: serializeAws_restJson1EventAttributes(input.attributes, context) }),
222
+ ...(input.eventName !== undefined && input.eventName !== null && { eventName: input.eventName }),
223
+ ...(input.roomIdentifier !== undefined &&
224
+ input.roomIdentifier !== null && { roomIdentifier: input.roomIdentifier }),
225
+ });
226
+ return new protocol_http_1.HttpRequest({
227
+ protocol,
228
+ hostname,
229
+ port,
230
+ method: "POST",
231
+ headers,
232
+ path: resolvedPath,
233
+ body,
234
+ });
235
+ };
236
+ exports.serializeAws_restJson1SendEventCommand = serializeAws_restJson1SendEventCommand;
237
+ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
238
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
239
+ const headers = {
240
+ "content-type": "application/json",
241
+ };
242
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
243
+ if (input.resourceArn !== undefined) {
244
+ const labelValue = input.resourceArn;
245
+ if (labelValue.length <= 0) {
246
+ throw new Error("Empty value provided for input HTTP label: resourceArn.");
247
+ }
248
+ resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
249
+ }
250
+ else {
251
+ throw new Error("No value provided for input HTTP label: resourceArn.");
252
+ }
253
+ let body;
254
+ body = JSON.stringify({
255
+ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
256
+ });
257
+ return new protocol_http_1.HttpRequest({
258
+ protocol,
259
+ hostname,
260
+ port,
261
+ method: "POST",
262
+ headers,
263
+ path: resolvedPath,
264
+ body,
265
+ });
266
+ };
267
+ exports.serializeAws_restJson1TagResourceCommand = serializeAws_restJson1TagResourceCommand;
268
+ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
269
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
270
+ const headers = {};
271
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
272
+ if (input.resourceArn !== undefined) {
273
+ const labelValue = input.resourceArn;
274
+ if (labelValue.length <= 0) {
275
+ throw new Error("Empty value provided for input HTTP label: resourceArn.");
276
+ }
277
+ resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
278
+ }
279
+ else {
280
+ throw new Error("No value provided for input HTTP label: resourceArn.");
281
+ }
282
+ const query = {
283
+ ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
284
+ };
285
+ let body;
286
+ return new protocol_http_1.HttpRequest({
287
+ protocol,
288
+ hostname,
289
+ port,
290
+ method: "DELETE",
291
+ headers,
292
+ path: resolvedPath,
293
+ query,
294
+ body,
295
+ });
296
+ };
297
+ exports.serializeAws_restJson1UntagResourceCommand = serializeAws_restJson1UntagResourceCommand;
298
+ const serializeAws_restJson1UpdateRoomCommand = async (input, context) => {
299
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
300
+ const headers = {
301
+ "content-type": "application/json",
302
+ };
303
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateRoom";
304
+ let body;
305
+ body = JSON.stringify({
306
+ ...(input.identifier !== undefined && input.identifier !== null && { identifier: input.identifier }),
307
+ ...(input.maximumMessageLength !== undefined &&
308
+ input.maximumMessageLength !== null && { maximumMessageLength: input.maximumMessageLength }),
309
+ ...(input.maximumMessageRatePerSecond !== undefined &&
310
+ input.maximumMessageRatePerSecond !== null && { maximumMessageRatePerSecond: input.maximumMessageRatePerSecond }),
311
+ ...(input.messageReviewHandler !== undefined &&
312
+ input.messageReviewHandler !== null && {
313
+ messageReviewHandler: serializeAws_restJson1MessageReviewHandler(input.messageReviewHandler, context),
314
+ }),
315
+ ...(input.name !== undefined && input.name !== null && { name: input.name }),
316
+ });
317
+ return new protocol_http_1.HttpRequest({
318
+ protocol,
319
+ hostname,
320
+ port,
321
+ method: "POST",
322
+ headers,
323
+ path: resolvedPath,
324
+ body,
325
+ });
326
+ };
327
+ exports.serializeAws_restJson1UpdateRoomCommand = serializeAws_restJson1UpdateRoomCommand;
328
+ const deserializeAws_restJson1CreateChatTokenCommand = async (output, context) => {
329
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
330
+ return deserializeAws_restJson1CreateChatTokenCommandError(output, context);
331
+ }
332
+ const contents = {
333
+ $metadata: deserializeMetadata(output),
334
+ sessionExpirationTime: undefined,
335
+ token: undefined,
336
+ tokenExpirationTime: undefined,
337
+ };
338
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
339
+ if (data.sessionExpirationTime !== undefined && data.sessionExpirationTime !== null) {
340
+ contents.sessionExpirationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.sessionExpirationTime));
341
+ }
342
+ if (data.token !== undefined && data.token !== null) {
343
+ contents.token = (0, smithy_client_1.expectString)(data.token);
344
+ }
345
+ if (data.tokenExpirationTime !== undefined && data.tokenExpirationTime !== null) {
346
+ contents.tokenExpirationTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.tokenExpirationTime));
347
+ }
348
+ return Promise.resolve(contents);
349
+ };
350
+ exports.deserializeAws_restJson1CreateChatTokenCommand = deserializeAws_restJson1CreateChatTokenCommand;
351
+ const deserializeAws_restJson1CreateChatTokenCommandError = async (output, context) => {
352
+ const parsedOutput = {
353
+ ...output,
354
+ body: await parseBody(output.body, context),
355
+ };
356
+ let response;
357
+ let errorCode = "UnknownError";
358
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
359
+ switch (errorCode) {
360
+ case "AccessDeniedException":
361
+ case "com.amazonaws.ivschat#AccessDeniedException":
362
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
363
+ case "PendingVerification":
364
+ case "com.amazonaws.ivschat#PendingVerification":
365
+ throw await deserializeAws_restJson1PendingVerificationResponse(parsedOutput, context);
366
+ case "ResourceNotFoundException":
367
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
368
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
369
+ case "ValidationException":
370
+ case "com.amazonaws.ivschat#ValidationException":
371
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
372
+ default:
373
+ const parsedBody = parsedOutput.body;
374
+ response = new IvschatServiceException_1.IvschatServiceException({
375
+ name: parsedBody.code || parsedBody.Code || errorCode,
376
+ $fault: "client",
377
+ $metadata: deserializeMetadata(output),
378
+ });
379
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
380
+ }
381
+ };
382
+ const deserializeAws_restJson1CreateRoomCommand = async (output, context) => {
383
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
384
+ return deserializeAws_restJson1CreateRoomCommandError(output, context);
385
+ }
386
+ const contents = {
387
+ $metadata: deserializeMetadata(output),
388
+ arn: undefined,
389
+ createTime: undefined,
390
+ id: undefined,
391
+ maximumMessageLength: undefined,
392
+ maximumMessageRatePerSecond: undefined,
393
+ messageReviewHandler: undefined,
394
+ name: undefined,
395
+ tags: undefined,
396
+ updateTime: undefined,
397
+ };
398
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
399
+ if (data.arn !== undefined && data.arn !== null) {
400
+ contents.arn = (0, smithy_client_1.expectString)(data.arn);
401
+ }
402
+ if (data.createTime !== undefined && data.createTime !== null) {
403
+ contents.createTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createTime));
404
+ }
405
+ if (data.id !== undefined && data.id !== null) {
406
+ contents.id = (0, smithy_client_1.expectString)(data.id);
407
+ }
408
+ if (data.maximumMessageLength !== undefined && data.maximumMessageLength !== null) {
409
+ contents.maximumMessageLength = (0, smithy_client_1.expectInt32)(data.maximumMessageLength);
410
+ }
411
+ if (data.maximumMessageRatePerSecond !== undefined && data.maximumMessageRatePerSecond !== null) {
412
+ contents.maximumMessageRatePerSecond = (0, smithy_client_1.expectInt32)(data.maximumMessageRatePerSecond);
413
+ }
414
+ if (data.messageReviewHandler !== undefined && data.messageReviewHandler !== null) {
415
+ contents.messageReviewHandler = deserializeAws_restJson1MessageReviewHandler(data.messageReviewHandler, context);
416
+ }
417
+ if (data.name !== undefined && data.name !== null) {
418
+ contents.name = (0, smithy_client_1.expectString)(data.name);
419
+ }
420
+ if (data.tags !== undefined && data.tags !== null) {
421
+ contents.tags = deserializeAws_restJson1Tags(data.tags, context);
422
+ }
423
+ if (data.updateTime !== undefined && data.updateTime !== null) {
424
+ contents.updateTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.updateTime));
425
+ }
426
+ return Promise.resolve(contents);
427
+ };
428
+ exports.deserializeAws_restJson1CreateRoomCommand = deserializeAws_restJson1CreateRoomCommand;
429
+ const deserializeAws_restJson1CreateRoomCommandError = async (output, context) => {
430
+ const parsedOutput = {
431
+ ...output,
432
+ body: await parseBody(output.body, context),
433
+ };
434
+ let response;
435
+ let errorCode = "UnknownError";
436
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
437
+ switch (errorCode) {
438
+ case "AccessDeniedException":
439
+ case "com.amazonaws.ivschat#AccessDeniedException":
440
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
441
+ case "ConflictException":
442
+ case "com.amazonaws.ivschat#ConflictException":
443
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
444
+ case "PendingVerification":
445
+ case "com.amazonaws.ivschat#PendingVerification":
446
+ throw await deserializeAws_restJson1PendingVerificationResponse(parsedOutput, context);
447
+ case "ResourceNotFoundException":
448
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
449
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
450
+ case "ServiceQuotaExceededException":
451
+ case "com.amazonaws.ivschat#ServiceQuotaExceededException":
452
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
453
+ case "ValidationException":
454
+ case "com.amazonaws.ivschat#ValidationException":
455
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
456
+ default:
457
+ const parsedBody = parsedOutput.body;
458
+ response = new IvschatServiceException_1.IvschatServiceException({
459
+ name: parsedBody.code || parsedBody.Code || errorCode,
460
+ $fault: "client",
461
+ $metadata: deserializeMetadata(output),
462
+ });
463
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
464
+ }
465
+ };
466
+ const deserializeAws_restJson1DeleteMessageCommand = async (output, context) => {
467
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
468
+ return deserializeAws_restJson1DeleteMessageCommandError(output, context);
469
+ }
470
+ const contents = {
471
+ $metadata: deserializeMetadata(output),
472
+ id: undefined,
473
+ };
474
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
475
+ if (data.id !== undefined && data.id !== null) {
476
+ contents.id = (0, smithy_client_1.expectString)(data.id);
477
+ }
478
+ return Promise.resolve(contents);
479
+ };
480
+ exports.deserializeAws_restJson1DeleteMessageCommand = deserializeAws_restJson1DeleteMessageCommand;
481
+ const deserializeAws_restJson1DeleteMessageCommandError = async (output, context) => {
482
+ const parsedOutput = {
483
+ ...output,
484
+ body: await parseBody(output.body, context),
485
+ };
486
+ let response;
487
+ let errorCode = "UnknownError";
488
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
489
+ switch (errorCode) {
490
+ case "AccessDeniedException":
491
+ case "com.amazonaws.ivschat#AccessDeniedException":
492
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
493
+ case "ResourceNotFoundException":
494
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
495
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
496
+ case "ThrottlingException":
497
+ case "com.amazonaws.ivschat#ThrottlingException":
498
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
499
+ case "ValidationException":
500
+ case "com.amazonaws.ivschat#ValidationException":
501
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
502
+ default:
503
+ const parsedBody = parsedOutput.body;
504
+ response = new IvschatServiceException_1.IvschatServiceException({
505
+ name: parsedBody.code || parsedBody.Code || errorCode,
506
+ $fault: "client",
507
+ $metadata: deserializeMetadata(output),
508
+ });
509
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
510
+ }
511
+ };
512
+ const deserializeAws_restJson1DeleteRoomCommand = async (output, context) => {
513
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
514
+ return deserializeAws_restJson1DeleteRoomCommandError(output, context);
515
+ }
516
+ const contents = {
517
+ $metadata: deserializeMetadata(output),
518
+ };
519
+ await collectBody(output.body, context);
520
+ return Promise.resolve(contents);
521
+ };
522
+ exports.deserializeAws_restJson1DeleteRoomCommand = deserializeAws_restJson1DeleteRoomCommand;
523
+ const deserializeAws_restJson1DeleteRoomCommandError = async (output, context) => {
524
+ const parsedOutput = {
525
+ ...output,
526
+ body: await parseBody(output.body, context),
527
+ };
528
+ let response;
529
+ let errorCode = "UnknownError";
530
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
531
+ switch (errorCode) {
532
+ case "AccessDeniedException":
533
+ case "com.amazonaws.ivschat#AccessDeniedException":
534
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
535
+ case "ResourceNotFoundException":
536
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
537
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
538
+ case "ValidationException":
539
+ case "com.amazonaws.ivschat#ValidationException":
540
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
541
+ default:
542
+ const parsedBody = parsedOutput.body;
543
+ response = new IvschatServiceException_1.IvschatServiceException({
544
+ name: parsedBody.code || parsedBody.Code || errorCode,
545
+ $fault: "client",
546
+ $metadata: deserializeMetadata(output),
547
+ });
548
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
549
+ }
550
+ };
551
+ const deserializeAws_restJson1DisconnectUserCommand = async (output, context) => {
552
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
553
+ return deserializeAws_restJson1DisconnectUserCommandError(output, context);
554
+ }
555
+ const contents = {
556
+ $metadata: deserializeMetadata(output),
557
+ };
558
+ await collectBody(output.body, context);
559
+ return Promise.resolve(contents);
560
+ };
561
+ exports.deserializeAws_restJson1DisconnectUserCommand = deserializeAws_restJson1DisconnectUserCommand;
562
+ const deserializeAws_restJson1DisconnectUserCommandError = async (output, context) => {
563
+ const parsedOutput = {
564
+ ...output,
565
+ body: await parseBody(output.body, context),
566
+ };
567
+ let response;
568
+ let errorCode = "UnknownError";
569
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
570
+ switch (errorCode) {
571
+ case "AccessDeniedException":
572
+ case "com.amazonaws.ivschat#AccessDeniedException":
573
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
574
+ case "ResourceNotFoundException":
575
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
576
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
577
+ case "ThrottlingException":
578
+ case "com.amazonaws.ivschat#ThrottlingException":
579
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
580
+ case "ValidationException":
581
+ case "com.amazonaws.ivschat#ValidationException":
582
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
583
+ default:
584
+ const parsedBody = parsedOutput.body;
585
+ response = new IvschatServiceException_1.IvschatServiceException({
586
+ name: parsedBody.code || parsedBody.Code || errorCode,
587
+ $fault: "client",
588
+ $metadata: deserializeMetadata(output),
589
+ });
590
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
591
+ }
592
+ };
593
+ const deserializeAws_restJson1GetRoomCommand = async (output, context) => {
594
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
595
+ return deserializeAws_restJson1GetRoomCommandError(output, context);
596
+ }
597
+ const contents = {
598
+ $metadata: deserializeMetadata(output),
599
+ arn: undefined,
600
+ createTime: undefined,
601
+ id: undefined,
602
+ maximumMessageLength: undefined,
603
+ maximumMessageRatePerSecond: undefined,
604
+ messageReviewHandler: undefined,
605
+ name: undefined,
606
+ tags: undefined,
607
+ updateTime: undefined,
608
+ };
609
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
610
+ if (data.arn !== undefined && data.arn !== null) {
611
+ contents.arn = (0, smithy_client_1.expectString)(data.arn);
612
+ }
613
+ if (data.createTime !== undefined && data.createTime !== null) {
614
+ contents.createTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createTime));
615
+ }
616
+ if (data.id !== undefined && data.id !== null) {
617
+ contents.id = (0, smithy_client_1.expectString)(data.id);
618
+ }
619
+ if (data.maximumMessageLength !== undefined && data.maximumMessageLength !== null) {
620
+ contents.maximumMessageLength = (0, smithy_client_1.expectInt32)(data.maximumMessageLength);
621
+ }
622
+ if (data.maximumMessageRatePerSecond !== undefined && data.maximumMessageRatePerSecond !== null) {
623
+ contents.maximumMessageRatePerSecond = (0, smithy_client_1.expectInt32)(data.maximumMessageRatePerSecond);
624
+ }
625
+ if (data.messageReviewHandler !== undefined && data.messageReviewHandler !== null) {
626
+ contents.messageReviewHandler = deserializeAws_restJson1MessageReviewHandler(data.messageReviewHandler, context);
627
+ }
628
+ if (data.name !== undefined && data.name !== null) {
629
+ contents.name = (0, smithy_client_1.expectString)(data.name);
630
+ }
631
+ if (data.tags !== undefined && data.tags !== null) {
632
+ contents.tags = deserializeAws_restJson1Tags(data.tags, context);
633
+ }
634
+ if (data.updateTime !== undefined && data.updateTime !== null) {
635
+ contents.updateTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.updateTime));
636
+ }
637
+ return Promise.resolve(contents);
638
+ };
639
+ exports.deserializeAws_restJson1GetRoomCommand = deserializeAws_restJson1GetRoomCommand;
640
+ const deserializeAws_restJson1GetRoomCommandError = async (output, context) => {
641
+ const parsedOutput = {
642
+ ...output,
643
+ body: await parseBody(output.body, context),
644
+ };
645
+ let response;
646
+ let errorCode = "UnknownError";
647
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
648
+ switch (errorCode) {
649
+ case "AccessDeniedException":
650
+ case "com.amazonaws.ivschat#AccessDeniedException":
651
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
652
+ case "ResourceNotFoundException":
653
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
654
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
655
+ case "ValidationException":
656
+ case "com.amazonaws.ivschat#ValidationException":
657
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
658
+ default:
659
+ const parsedBody = parsedOutput.body;
660
+ response = new IvschatServiceException_1.IvschatServiceException({
661
+ name: parsedBody.code || parsedBody.Code || errorCode,
662
+ $fault: "client",
663
+ $metadata: deserializeMetadata(output),
664
+ });
665
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
666
+ }
667
+ };
668
+ const deserializeAws_restJson1ListRoomsCommand = async (output, context) => {
669
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
670
+ return deserializeAws_restJson1ListRoomsCommandError(output, context);
671
+ }
672
+ const contents = {
673
+ $metadata: deserializeMetadata(output),
674
+ nextToken: undefined,
675
+ rooms: undefined,
676
+ };
677
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
678
+ if (data.nextToken !== undefined && data.nextToken !== null) {
679
+ contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
680
+ }
681
+ if (data.rooms !== undefined && data.rooms !== null) {
682
+ contents.rooms = deserializeAws_restJson1RoomList(data.rooms, context);
683
+ }
684
+ return Promise.resolve(contents);
685
+ };
686
+ exports.deserializeAws_restJson1ListRoomsCommand = deserializeAws_restJson1ListRoomsCommand;
687
+ const deserializeAws_restJson1ListRoomsCommandError = async (output, context) => {
688
+ const parsedOutput = {
689
+ ...output,
690
+ body: await parseBody(output.body, context),
691
+ };
692
+ let response;
693
+ let errorCode = "UnknownError";
694
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
695
+ switch (errorCode) {
696
+ case "AccessDeniedException":
697
+ case "com.amazonaws.ivschat#AccessDeniedException":
698
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
699
+ case "ResourceNotFoundException":
700
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
701
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
702
+ case "ValidationException":
703
+ case "com.amazonaws.ivschat#ValidationException":
704
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
705
+ default:
706
+ const parsedBody = parsedOutput.body;
707
+ response = new IvschatServiceException_1.IvschatServiceException({
708
+ name: parsedBody.code || parsedBody.Code || errorCode,
709
+ $fault: "client",
710
+ $metadata: deserializeMetadata(output),
711
+ });
712
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
713
+ }
714
+ };
715
+ const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
716
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
717
+ return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
718
+ }
719
+ const contents = {
720
+ $metadata: deserializeMetadata(output),
721
+ tags: undefined,
722
+ };
723
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
724
+ if (data.tags !== undefined && data.tags !== null) {
725
+ contents.tags = deserializeAws_restJson1Tags(data.tags, context);
726
+ }
727
+ return Promise.resolve(contents);
728
+ };
729
+ exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
730
+ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
731
+ const parsedOutput = {
732
+ ...output,
733
+ body: await parseBody(output.body, context),
734
+ };
735
+ let response;
736
+ let errorCode = "UnknownError";
737
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
738
+ switch (errorCode) {
739
+ case "InternalServerException":
740
+ case "com.amazonaws.ivschat#InternalServerException":
741
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
742
+ case "ResourceNotFoundException":
743
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
744
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
745
+ case "ValidationException":
746
+ case "com.amazonaws.ivschat#ValidationException":
747
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
748
+ default:
749
+ const parsedBody = parsedOutput.body;
750
+ response = new IvschatServiceException_1.IvschatServiceException({
751
+ name: parsedBody.code || parsedBody.Code || errorCode,
752
+ $fault: "client",
753
+ $metadata: deserializeMetadata(output),
754
+ });
755
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
756
+ }
757
+ };
758
+ const deserializeAws_restJson1SendEventCommand = async (output, context) => {
759
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
760
+ return deserializeAws_restJson1SendEventCommandError(output, context);
761
+ }
762
+ const contents = {
763
+ $metadata: deserializeMetadata(output),
764
+ id: undefined,
765
+ };
766
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
767
+ if (data.id !== undefined && data.id !== null) {
768
+ contents.id = (0, smithy_client_1.expectString)(data.id);
769
+ }
770
+ return Promise.resolve(contents);
771
+ };
772
+ exports.deserializeAws_restJson1SendEventCommand = deserializeAws_restJson1SendEventCommand;
773
+ const deserializeAws_restJson1SendEventCommandError = async (output, context) => {
774
+ const parsedOutput = {
775
+ ...output,
776
+ body: await parseBody(output.body, context),
777
+ };
778
+ let response;
779
+ let errorCode = "UnknownError";
780
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
781
+ switch (errorCode) {
782
+ case "AccessDeniedException":
783
+ case "com.amazonaws.ivschat#AccessDeniedException":
784
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
785
+ case "ResourceNotFoundException":
786
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
787
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
788
+ case "ThrottlingException":
789
+ case "com.amazonaws.ivschat#ThrottlingException":
790
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
791
+ case "ValidationException":
792
+ case "com.amazonaws.ivschat#ValidationException":
793
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
794
+ default:
795
+ const parsedBody = parsedOutput.body;
796
+ response = new IvschatServiceException_1.IvschatServiceException({
797
+ name: parsedBody.code || parsedBody.Code || errorCode,
798
+ $fault: "client",
799
+ $metadata: deserializeMetadata(output),
800
+ });
801
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
802
+ }
803
+ };
804
+ const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
805
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
806
+ return deserializeAws_restJson1TagResourceCommandError(output, context);
807
+ }
808
+ const contents = {
809
+ $metadata: deserializeMetadata(output),
810
+ };
811
+ await collectBody(output.body, context);
812
+ return Promise.resolve(contents);
813
+ };
814
+ exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
815
+ const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
816
+ const parsedOutput = {
817
+ ...output,
818
+ body: await parseBody(output.body, context),
819
+ };
820
+ let response;
821
+ let errorCode = "UnknownError";
822
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
823
+ switch (errorCode) {
824
+ case "InternalServerException":
825
+ case "com.amazonaws.ivschat#InternalServerException":
826
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
827
+ case "ResourceNotFoundException":
828
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
829
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
830
+ case "ValidationException":
831
+ case "com.amazonaws.ivschat#ValidationException":
832
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
833
+ default:
834
+ const parsedBody = parsedOutput.body;
835
+ response = new IvschatServiceException_1.IvschatServiceException({
836
+ name: parsedBody.code || parsedBody.Code || errorCode,
837
+ $fault: "client",
838
+ $metadata: deserializeMetadata(output),
839
+ });
840
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
841
+ }
842
+ };
843
+ const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
844
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
845
+ return deserializeAws_restJson1UntagResourceCommandError(output, context);
846
+ }
847
+ const contents = {
848
+ $metadata: deserializeMetadata(output),
849
+ };
850
+ await collectBody(output.body, context);
851
+ return Promise.resolve(contents);
852
+ };
853
+ exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
854
+ const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
855
+ const parsedOutput = {
856
+ ...output,
857
+ body: await parseBody(output.body, context),
858
+ };
859
+ let response;
860
+ let errorCode = "UnknownError";
861
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
862
+ switch (errorCode) {
863
+ case "InternalServerException":
864
+ case "com.amazonaws.ivschat#InternalServerException":
865
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
866
+ case "ResourceNotFoundException":
867
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
868
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
869
+ case "ValidationException":
870
+ case "com.amazonaws.ivschat#ValidationException":
871
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
872
+ default:
873
+ const parsedBody = parsedOutput.body;
874
+ response = new IvschatServiceException_1.IvschatServiceException({
875
+ name: parsedBody.code || parsedBody.Code || errorCode,
876
+ $fault: "client",
877
+ $metadata: deserializeMetadata(output),
878
+ });
879
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
880
+ }
881
+ };
882
+ const deserializeAws_restJson1UpdateRoomCommand = async (output, context) => {
883
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
884
+ return deserializeAws_restJson1UpdateRoomCommandError(output, context);
885
+ }
886
+ const contents = {
887
+ $metadata: deserializeMetadata(output),
888
+ arn: undefined,
889
+ createTime: undefined,
890
+ id: undefined,
891
+ maximumMessageLength: undefined,
892
+ maximumMessageRatePerSecond: undefined,
893
+ messageReviewHandler: undefined,
894
+ name: undefined,
895
+ tags: undefined,
896
+ updateTime: undefined,
897
+ };
898
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
899
+ if (data.arn !== undefined && data.arn !== null) {
900
+ contents.arn = (0, smithy_client_1.expectString)(data.arn);
901
+ }
902
+ if (data.createTime !== undefined && data.createTime !== null) {
903
+ contents.createTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createTime));
904
+ }
905
+ if (data.id !== undefined && data.id !== null) {
906
+ contents.id = (0, smithy_client_1.expectString)(data.id);
907
+ }
908
+ if (data.maximumMessageLength !== undefined && data.maximumMessageLength !== null) {
909
+ contents.maximumMessageLength = (0, smithy_client_1.expectInt32)(data.maximumMessageLength);
910
+ }
911
+ if (data.maximumMessageRatePerSecond !== undefined && data.maximumMessageRatePerSecond !== null) {
912
+ contents.maximumMessageRatePerSecond = (0, smithy_client_1.expectInt32)(data.maximumMessageRatePerSecond);
913
+ }
914
+ if (data.messageReviewHandler !== undefined && data.messageReviewHandler !== null) {
915
+ contents.messageReviewHandler = deserializeAws_restJson1MessageReviewHandler(data.messageReviewHandler, context);
916
+ }
917
+ if (data.name !== undefined && data.name !== null) {
918
+ contents.name = (0, smithy_client_1.expectString)(data.name);
919
+ }
920
+ if (data.tags !== undefined && data.tags !== null) {
921
+ contents.tags = deserializeAws_restJson1Tags(data.tags, context);
922
+ }
923
+ if (data.updateTime !== undefined && data.updateTime !== null) {
924
+ contents.updateTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.updateTime));
925
+ }
926
+ return Promise.resolve(contents);
927
+ };
928
+ exports.deserializeAws_restJson1UpdateRoomCommand = deserializeAws_restJson1UpdateRoomCommand;
929
+ const deserializeAws_restJson1UpdateRoomCommandError = async (output, context) => {
930
+ const parsedOutput = {
931
+ ...output,
932
+ body: await parseBody(output.body, context),
933
+ };
934
+ let response;
935
+ let errorCode = "UnknownError";
936
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
937
+ switch (errorCode) {
938
+ case "AccessDeniedException":
939
+ case "com.amazonaws.ivschat#AccessDeniedException":
940
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
941
+ case "ResourceNotFoundException":
942
+ case "com.amazonaws.ivschat#ResourceNotFoundException":
943
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
944
+ case "ValidationException":
945
+ case "com.amazonaws.ivschat#ValidationException":
946
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
947
+ default:
948
+ const parsedBody = parsedOutput.body;
949
+ response = new IvschatServiceException_1.IvschatServiceException({
950
+ name: parsedBody.code || parsedBody.Code || errorCode,
951
+ $fault: "client",
952
+ $metadata: deserializeMetadata(output),
953
+ });
954
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
955
+ }
956
+ };
957
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
958
+ const contents = {};
959
+ const data = parsedOutput.body;
960
+ if (data.message !== undefined && data.message !== null) {
961
+ contents.message = (0, smithy_client_1.expectString)(data.message);
962
+ }
963
+ const exception = new models_0_1.AccessDeniedException({
964
+ $metadata: deserializeMetadata(parsedOutput),
965
+ ...contents,
966
+ });
967
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
968
+ };
969
+ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
970
+ const contents = {};
971
+ const data = parsedOutput.body;
972
+ if (data.message !== undefined && data.message !== null) {
973
+ contents.message = (0, smithy_client_1.expectString)(data.message);
974
+ }
975
+ if (data.resourceId !== undefined && data.resourceId !== null) {
976
+ contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
977
+ }
978
+ if (data.resourceType !== undefined && data.resourceType !== null) {
979
+ contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
980
+ }
981
+ const exception = new models_0_1.ConflictException({
982
+ $metadata: deserializeMetadata(parsedOutput),
983
+ ...contents,
984
+ });
985
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
986
+ };
987
+ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
988
+ const contents = {};
989
+ const data = parsedOutput.body;
990
+ if (data.message !== undefined && data.message !== null) {
991
+ contents.message = (0, smithy_client_1.expectString)(data.message);
992
+ }
993
+ const exception = new models_0_1.InternalServerException({
994
+ $metadata: deserializeMetadata(parsedOutput),
995
+ ...contents,
996
+ });
997
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
998
+ };
999
+ const deserializeAws_restJson1PendingVerificationResponse = async (parsedOutput, context) => {
1000
+ const contents = {};
1001
+ const data = parsedOutput.body;
1002
+ if (data.message !== undefined && data.message !== null) {
1003
+ contents.message = (0, smithy_client_1.expectString)(data.message);
1004
+ }
1005
+ const exception = new models_0_1.PendingVerification({
1006
+ $metadata: deserializeMetadata(parsedOutput),
1007
+ ...contents,
1008
+ });
1009
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1010
+ };
1011
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1012
+ const contents = {};
1013
+ const data = parsedOutput.body;
1014
+ if (data.message !== undefined && data.message !== null) {
1015
+ contents.message = (0, smithy_client_1.expectString)(data.message);
1016
+ }
1017
+ if (data.resourceId !== undefined && data.resourceId !== null) {
1018
+ contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1019
+ }
1020
+ if (data.resourceType !== undefined && data.resourceType !== null) {
1021
+ contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1022
+ }
1023
+ const exception = new models_0_1.ResourceNotFoundException({
1024
+ $metadata: deserializeMetadata(parsedOutput),
1025
+ ...contents,
1026
+ });
1027
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1028
+ };
1029
+ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1030
+ const contents = {};
1031
+ const data = parsedOutput.body;
1032
+ if (data.limit !== undefined && data.limit !== null) {
1033
+ contents.limit = (0, smithy_client_1.expectInt32)(data.limit);
1034
+ }
1035
+ if (data.message !== undefined && data.message !== null) {
1036
+ contents.message = (0, smithy_client_1.expectString)(data.message);
1037
+ }
1038
+ if (data.resourceId !== undefined && data.resourceId !== null) {
1039
+ contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1040
+ }
1041
+ if (data.resourceType !== undefined && data.resourceType !== null) {
1042
+ contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1043
+ }
1044
+ const exception = new models_0_1.ServiceQuotaExceededException({
1045
+ $metadata: deserializeMetadata(parsedOutput),
1046
+ ...contents,
1047
+ });
1048
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1049
+ };
1050
+ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1051
+ const contents = {};
1052
+ const data = parsedOutput.body;
1053
+ if (data.limit !== undefined && data.limit !== null) {
1054
+ contents.limit = (0, smithy_client_1.expectInt32)(data.limit);
1055
+ }
1056
+ if (data.message !== undefined && data.message !== null) {
1057
+ contents.message = (0, smithy_client_1.expectString)(data.message);
1058
+ }
1059
+ if (data.resourceId !== undefined && data.resourceId !== null) {
1060
+ contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
1061
+ }
1062
+ if (data.resourceType !== undefined && data.resourceType !== null) {
1063
+ contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
1064
+ }
1065
+ const exception = new models_0_1.ThrottlingException({
1066
+ $metadata: deserializeMetadata(parsedOutput),
1067
+ ...contents,
1068
+ });
1069
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1070
+ };
1071
+ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1072
+ const contents = {};
1073
+ const data = parsedOutput.body;
1074
+ if (data.fieldList !== undefined && data.fieldList !== null) {
1075
+ contents.fieldList = deserializeAws_restJson1ValidationExceptionFieldList(data.fieldList, context);
1076
+ }
1077
+ if (data.message !== undefined && data.message !== null) {
1078
+ contents.message = (0, smithy_client_1.expectString)(data.message);
1079
+ }
1080
+ if (data.reason !== undefined && data.reason !== null) {
1081
+ contents.reason = (0, smithy_client_1.expectString)(data.reason);
1082
+ }
1083
+ const exception = new models_0_1.ValidationException({
1084
+ $metadata: deserializeMetadata(parsedOutput),
1085
+ ...contents,
1086
+ });
1087
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1088
+ };
1089
+ const serializeAws_restJson1ChatTokenAttributes = (input, context) => {
1090
+ return Object.entries(input).reduce((acc, [key, value]) => {
1091
+ if (value === null) {
1092
+ return acc;
1093
+ }
1094
+ return {
1095
+ ...acc,
1096
+ [key]: value,
1097
+ };
1098
+ }, {});
1099
+ };
1100
+ const serializeAws_restJson1ChatTokenCapabilities = (input, context) => {
1101
+ return input
1102
+ .filter((e) => e != null)
1103
+ .map((entry) => {
1104
+ if (entry === null) {
1105
+ return null;
1106
+ }
1107
+ return entry;
1108
+ });
1109
+ };
1110
+ const serializeAws_restJson1EventAttributes = (input, context) => {
1111
+ return Object.entries(input).reduce((acc, [key, value]) => {
1112
+ if (value === null) {
1113
+ return acc;
1114
+ }
1115
+ return {
1116
+ ...acc,
1117
+ [key]: value,
1118
+ };
1119
+ }, {});
1120
+ };
1121
+ const serializeAws_restJson1MessageReviewHandler = (input, context) => {
1122
+ return {
1123
+ ...(input.fallbackResult !== undefined &&
1124
+ input.fallbackResult !== null && { fallbackResult: input.fallbackResult }),
1125
+ ...(input.uri !== undefined && input.uri !== null && { uri: input.uri }),
1126
+ };
1127
+ };
1128
+ const serializeAws_restJson1Tags = (input, context) => {
1129
+ return Object.entries(input).reduce((acc, [key, value]) => {
1130
+ if (value === null) {
1131
+ return acc;
1132
+ }
1133
+ return {
1134
+ ...acc,
1135
+ [key]: value,
1136
+ };
1137
+ }, {});
1138
+ };
1139
+ const deserializeAws_restJson1MessageReviewHandler = (output, context) => {
1140
+ return {
1141
+ fallbackResult: (0, smithy_client_1.expectString)(output.fallbackResult),
1142
+ uri: (0, smithy_client_1.expectString)(output.uri),
1143
+ };
1144
+ };
1145
+ const deserializeAws_restJson1RoomList = (output, context) => {
1146
+ const retVal = (output || [])
1147
+ .filter((e) => e != null)
1148
+ .map((entry) => {
1149
+ if (entry === null) {
1150
+ return null;
1151
+ }
1152
+ return deserializeAws_restJson1RoomSummary(entry, context);
1153
+ });
1154
+ return retVal;
1155
+ };
1156
+ const deserializeAws_restJson1RoomSummary = (output, context) => {
1157
+ return {
1158
+ arn: (0, smithy_client_1.expectString)(output.arn),
1159
+ createTime: output.createTime !== undefined && output.createTime !== null
1160
+ ? (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(output.createTime))
1161
+ : undefined,
1162
+ id: (0, smithy_client_1.expectString)(output.id),
1163
+ messageReviewHandler: output.messageReviewHandler !== undefined && output.messageReviewHandler !== null
1164
+ ? deserializeAws_restJson1MessageReviewHandler(output.messageReviewHandler, context)
1165
+ : undefined,
1166
+ name: (0, smithy_client_1.expectString)(output.name),
1167
+ tags: output.tags !== undefined && output.tags !== null
1168
+ ? deserializeAws_restJson1Tags(output.tags, context)
1169
+ : undefined,
1170
+ updateTime: output.updateTime !== undefined && output.updateTime !== null
1171
+ ? (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(output.updateTime))
1172
+ : undefined,
1173
+ };
1174
+ };
1175
+ const deserializeAws_restJson1Tags = (output, context) => {
1176
+ return Object.entries(output).reduce((acc, [key, value]) => {
1177
+ if (value === null) {
1178
+ return acc;
1179
+ }
1180
+ return {
1181
+ ...acc,
1182
+ [key]: (0, smithy_client_1.expectString)(value),
1183
+ };
1184
+ }, {});
1185
+ };
1186
+ const deserializeAws_restJson1ValidationExceptionField = (output, context) => {
1187
+ return {
1188
+ message: (0, smithy_client_1.expectString)(output.message),
1189
+ name: (0, smithy_client_1.expectString)(output.name),
1190
+ };
1191
+ };
1192
+ const deserializeAws_restJson1ValidationExceptionFieldList = (output, context) => {
1193
+ const retVal = (output || [])
1194
+ .filter((e) => e != null)
1195
+ .map((entry) => {
1196
+ if (entry === null) {
1197
+ return null;
1198
+ }
1199
+ return deserializeAws_restJson1ValidationExceptionField(entry, context);
1200
+ });
1201
+ return retVal;
1202
+ };
1203
+ const deserializeMetadata = (output) => {
1204
+ var _a;
1205
+ return ({
1206
+ httpStatusCode: output.statusCode,
1207
+ requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
1208
+ extendedRequestId: output.headers["x-amz-id-2"],
1209
+ cfId: output.headers["x-amz-cf-id"],
1210
+ });
1211
+ };
1212
+ const collectBody = (streamBody = new Uint8Array(), context) => {
1213
+ if (streamBody instanceof Uint8Array) {
1214
+ return Promise.resolve(streamBody);
1215
+ }
1216
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1217
+ };
1218
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1219
+ const isSerializableHeaderValue = (value) => value !== undefined &&
1220
+ value !== null &&
1221
+ value !== "" &&
1222
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1223
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1224
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1225
+ if (encoded.length) {
1226
+ return JSON.parse(encoded);
1227
+ }
1228
+ return {};
1229
+ });
1230
+ const loadRestJsonErrorCode = (output, data) => {
1231
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1232
+ const sanitizeErrorCode = (rawValue) => {
1233
+ let cleanValue = rawValue;
1234
+ if (cleanValue.indexOf(":") >= 0) {
1235
+ cleanValue = cleanValue.split(":")[0];
1236
+ }
1237
+ if (cleanValue.indexOf("#") >= 0) {
1238
+ cleanValue = cleanValue.split("#")[1];
1239
+ }
1240
+ return cleanValue;
1241
+ };
1242
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
1243
+ if (headerKey !== undefined) {
1244
+ return sanitizeErrorCode(output.headers[headerKey]);
1245
+ }
1246
+ if (data.code !== undefined) {
1247
+ return sanitizeErrorCode(data.code);
1248
+ }
1249
+ if (data["__type"] !== undefined) {
1250
+ return sanitizeErrorCode(data["__type"]);
1251
+ }
1252
+ return "";
1253
+ };