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