@aws-sdk/client-cognito-sync 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.
Files changed (29) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist-es/CognitoSync.js +70 -77
  3. package/dist-es/CognitoSyncClient.js +22 -28
  4. package/dist-es/commands/BulkPublishCommand.js +21 -28
  5. package/dist-es/commands/DeleteDatasetCommand.js +21 -28
  6. package/dist-es/commands/DescribeDatasetCommand.js +21 -28
  7. package/dist-es/commands/DescribeIdentityPoolUsageCommand.js +21 -28
  8. package/dist-es/commands/DescribeIdentityUsageCommand.js +21 -28
  9. package/dist-es/commands/GetBulkPublishDetailsCommand.js +21 -28
  10. package/dist-es/commands/GetCognitoEventsCommand.js +21 -28
  11. package/dist-es/commands/GetIdentityPoolConfigurationCommand.js +21 -28
  12. package/dist-es/commands/ListDatasetsCommand.js +21 -28
  13. package/dist-es/commands/ListIdentityPoolUsageCommand.js +21 -28
  14. package/dist-es/commands/ListRecordsCommand.js +21 -28
  15. package/dist-es/commands/RegisterDeviceCommand.js +21 -28
  16. package/dist-es/commands/SetCognitoEventsCommand.js +22 -29
  17. package/dist-es/commands/SetIdentityPoolConfigurationCommand.js +21 -28
  18. package/dist-es/commands/SubscribeToDatasetCommand.js +21 -28
  19. package/dist-es/commands/UnsubscribeFromDatasetCommand.js +21 -28
  20. package/dist-es/commands/UpdateRecordsCommand.js +21 -28
  21. package/dist-es/endpoints.js +8 -8
  22. package/dist-es/models/CognitoSyncServiceException.js +5 -10
  23. package/dist-es/models/models_0.js +263 -184
  24. package/dist-es/protocols/Aws_restJson1.js +1389 -1942
  25. package/dist-es/runtimeConfig.browser.js +26 -12
  26. package/dist-es/runtimeConfig.js +30 -12
  27. package/dist-es/runtimeConfig.native.js +8 -5
  28. package/dist-es/runtimeConfig.shared.js +8 -11
  29. package/package.json +33 -33
@@ -1,1939 +1,1403 @@
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, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { CognitoSyncServiceException as __BaseException } from "../models/CognitoSyncServiceException";
5
4
  import { AlreadyStreamedException, ConcurrentModificationException, DuplicateRequestException, InternalErrorException, InvalidConfigurationException, InvalidLambdaFunctionOutputException, InvalidParameterException, LambdaThrottledException, LimitExceededException, NotAuthorizedException, ResourceConflictException, ResourceNotFoundException, TooManyRequestsException, } from "../models/models_0";
6
- export var serializeAws_restJson1BulkPublishCommand = 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
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
15
- "/identitypools/{IdentityPoolId}/bulkpublish";
16
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
17
- return [2, new __HttpRequest({
18
- protocol: protocol,
19
- hostname: hostname,
20
- port: port,
21
- method: "POST",
22
- headers: headers,
23
- path: resolvedPath,
24
- body: body,
25
- })];
26
- }
27
- });
28
- }); };
29
- export var serializeAws_restJson1DeleteDatasetCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
30
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
31
- return __generator(this, function (_c) {
32
- switch (_c.label) {
33
- case 0: return [4, context.endpoint()];
34
- case 1:
35
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
36
- headers = {};
37
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
38
- "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}";
39
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
40
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", function () { return input.IdentityId; }, "{IdentityId}", false);
41
- resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", function () { return input.DatasetName; }, "{DatasetName}", false);
42
- return [2, new __HttpRequest({
43
- protocol: protocol,
44
- hostname: hostname,
45
- port: port,
46
- method: "DELETE",
47
- headers: headers,
48
- path: resolvedPath,
49
- body: body,
50
- })];
51
- }
52
- });
53
- }); };
54
- export var serializeAws_restJson1DescribeDatasetCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
55
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
56
- return __generator(this, function (_c) {
57
- switch (_c.label) {
58
- case 0: return [4, context.endpoint()];
59
- case 1:
60
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
61
- headers = {};
62
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
63
- "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}";
64
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
65
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", function () { return input.IdentityId; }, "{IdentityId}", false);
66
- resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", function () { return input.DatasetName; }, "{DatasetName}", false);
67
- return [2, new __HttpRequest({
68
- protocol: protocol,
69
- hostname: hostname,
70
- port: port,
71
- method: "GET",
72
- headers: headers,
73
- path: resolvedPath,
74
- body: body,
75
- })];
76
- }
77
- });
78
- }); };
79
- export var serializeAws_restJson1DescribeIdentityPoolUsageCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
80
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
81
- return __generator(this, function (_c) {
82
- switch (_c.label) {
83
- case 0: return [4, context.endpoint()];
84
- case 1:
85
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
86
- headers = {};
87
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/identitypools/{IdentityPoolId}";
88
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
89
- return [2, new __HttpRequest({
90
- protocol: protocol,
91
- hostname: hostname,
92
- port: port,
93
- method: "GET",
94
- headers: headers,
95
- path: resolvedPath,
96
- body: body,
97
- })];
98
- }
99
- });
100
- }); };
101
- export var serializeAws_restJson1DescribeIdentityUsageCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
102
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
103
- return __generator(this, function (_c) {
104
- switch (_c.label) {
105
- case 0: return [4, context.endpoint()];
106
- case 1:
107
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
108
- headers = {};
109
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
110
- "/identitypools/{IdentityPoolId}/identities/{IdentityId}";
111
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
112
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", function () { return input.IdentityId; }, "{IdentityId}", false);
113
- return [2, new __HttpRequest({
114
- protocol: protocol,
115
- hostname: hostname,
116
- port: port,
117
- method: "GET",
118
- headers: headers,
119
- path: resolvedPath,
120
- body: body,
121
- })];
122
- }
123
- });
124
- }); };
125
- export var serializeAws_restJson1GetBulkPublishDetailsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
126
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
127
- return __generator(this, function (_c) {
128
- switch (_c.label) {
129
- case 0: return [4, context.endpoint()];
130
- case 1:
131
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
132
- headers = {};
133
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
134
- "/identitypools/{IdentityPoolId}/getBulkPublishDetails";
135
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
136
- return [2, new __HttpRequest({
137
- protocol: protocol,
138
- hostname: hostname,
139
- port: port,
140
- method: "POST",
141
- headers: headers,
142
- path: resolvedPath,
143
- body: body,
144
- })];
145
- }
146
- });
147
- }); };
148
- export var serializeAws_restJson1GetCognitoEventsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
149
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
150
- return __generator(this, function (_c) {
151
- switch (_c.label) {
152
- case 0: return [4, context.endpoint()];
153
- case 1:
154
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
155
- headers = {};
156
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/identitypools/{IdentityPoolId}/events";
157
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
158
- return [2, new __HttpRequest({
159
- protocol: protocol,
160
- hostname: hostname,
161
- port: port,
162
- method: "GET",
163
- headers: headers,
164
- path: resolvedPath,
165
- body: body,
166
- })];
167
- }
168
- });
169
- }); };
170
- export var serializeAws_restJson1GetIdentityPoolConfigurationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
171
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
172
- return __generator(this, function (_c) {
173
- switch (_c.label) {
174
- case 0: return [4, context.endpoint()];
175
- case 1:
176
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
177
- headers = {};
178
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
179
- "/identitypools/{IdentityPoolId}/configuration";
180
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
181
- return [2, new __HttpRequest({
182
- protocol: protocol,
183
- hostname: hostname,
184
- port: port,
185
- method: "GET",
186
- headers: headers,
187
- path: resolvedPath,
188
- body: body,
189
- })];
190
- }
191
- });
192
- }); };
193
- export var serializeAws_restJson1ListDatasetsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
194
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
195
- return __generator(this, function (_c) {
196
- switch (_c.label) {
197
- case 0: return [4, context.endpoint()];
198
- case 1:
199
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
200
- headers = {};
201
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
202
- "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets";
203
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
204
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", function () { return input.IdentityId; }, "{IdentityId}", false);
205
- query = map({
206
- nextToken: [, input.NextToken],
207
- maxResults: [function () { return input.MaxResults !== void 0; }, function () { return input.MaxResults.toString(); }],
208
- });
209
- return [2, new __HttpRequest({
210
- protocol: protocol,
211
- hostname: hostname,
212
- port: port,
213
- method: "GET",
214
- headers: headers,
215
- path: resolvedPath,
216
- query: query,
217
- body: body,
218
- })];
219
- }
220
- });
221
- }); };
222
- export var serializeAws_restJson1ListIdentityPoolUsageCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
223
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
224
- return __generator(this, function (_c) {
225
- switch (_c.label) {
226
- case 0: return [4, context.endpoint()];
227
- case 1:
228
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
229
- headers = {};
230
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/identitypools";
231
- query = map({
232
- nextToken: [, input.NextToken],
233
- maxResults: [function () { return input.MaxResults !== void 0; }, function () { return input.MaxResults.toString(); }],
234
- });
235
- return [2, new __HttpRequest({
236
- protocol: protocol,
237
- hostname: hostname,
238
- port: port,
239
- method: "GET",
240
- headers: headers,
241
- path: resolvedPath,
242
- query: query,
243
- body: body,
244
- })];
245
- }
246
- });
247
- }); };
248
- export var serializeAws_restJson1ListRecordsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
249
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
250
- return __generator(this, function (_c) {
251
- switch (_c.label) {
252
- case 0: return [4, context.endpoint()];
253
- case 1:
254
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
255
- headers = {};
256
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
257
- "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/records";
258
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
259
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", function () { return input.IdentityId; }, "{IdentityId}", false);
260
- resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", function () { return input.DatasetName; }, "{DatasetName}", false);
261
- query = map({
262
- lastSyncCount: [function () { return input.LastSyncCount !== void 0; }, function () { return input.LastSyncCount.toString(); }],
263
- nextToken: [, input.NextToken],
264
- maxResults: [function () { return input.MaxResults !== void 0; }, function () { return input.MaxResults.toString(); }],
265
- syncSessionToken: [, input.SyncSessionToken],
266
- });
267
- return [2, new __HttpRequest({
268
- protocol: protocol,
269
- hostname: hostname,
270
- port: port,
271
- method: "GET",
272
- headers: headers,
273
- path: resolvedPath,
274
- query: query,
275
- body: body,
276
- })];
277
- }
278
- });
279
- }); };
280
- export var serializeAws_restJson1RegisterDeviceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
281
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
282
- return __generator(this, function (_c) {
283
- switch (_c.label) {
284
- case 0: return [4, context.endpoint()];
285
- case 1:
286
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
287
- headers = {
288
- "content-type": "application/json",
289
- };
290
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
291
- "/identitypools/{IdentityPoolId}/identity/{IdentityId}/device";
292
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
293
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", function () { return input.IdentityId; }, "{IdentityId}", false);
294
- body = JSON.stringify(__assign(__assign({}, (input.Platform != null && { Platform: input.Platform })), (input.Token != null && { Token: input.Token })));
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
- }
305
- });
306
- }); };
307
- export var serializeAws_restJson1SetCognitoEventsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
308
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
309
- return __generator(this, function (_c) {
310
- switch (_c.label) {
311
- case 0: return [4, context.endpoint()];
312
- case 1:
313
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
314
- headers = {
315
- "content-type": "application/json",
316
- };
317
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/identitypools/{IdentityPoolId}/events";
318
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
319
- body = JSON.stringify(__assign({}, (input.Events != null && { Events: serializeAws_restJson1Events(input.Events, context) })));
320
- return [2, new __HttpRequest({
321
- protocol: protocol,
322
- hostname: hostname,
323
- port: port,
324
- method: "POST",
325
- headers: headers,
326
- path: resolvedPath,
327
- body: body,
328
- })];
329
- }
330
- });
331
- }); };
332
- export var serializeAws_restJson1SetIdentityPoolConfigurationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
333
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
334
- return __generator(this, function (_c) {
335
- switch (_c.label) {
336
- case 0: return [4, context.endpoint()];
337
- case 1:
338
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
339
- headers = {
340
- "content-type": "application/json",
341
- };
342
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
343
- "/identitypools/{IdentityPoolId}/configuration";
344
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
345
- body = JSON.stringify(__assign(__assign({}, (input.CognitoStreams != null && {
346
- CognitoStreams: serializeAws_restJson1CognitoStreams(input.CognitoStreams, context),
347
- })), (input.PushSync != null && { PushSync: serializeAws_restJson1PushSync(input.PushSync, context) })));
348
- return [2, new __HttpRequest({
349
- protocol: protocol,
350
- hostname: hostname,
351
- port: port,
352
- method: "POST",
353
- headers: headers,
354
- path: resolvedPath,
355
- body: body,
356
- })];
357
- }
358
- });
359
- }); };
360
- export var serializeAws_restJson1SubscribeToDatasetCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
361
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
362
- return __generator(this, function (_c) {
363
- switch (_c.label) {
364
- case 0: return [4, context.endpoint()];
365
- case 1:
366
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
367
- headers = {};
368
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
369
- "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}";
370
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
371
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", function () { return input.IdentityId; }, "{IdentityId}", false);
372
- resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", function () { return input.DatasetName; }, "{DatasetName}", false);
373
- resolvedPath = __resolvedPath(resolvedPath, input, "DeviceId", function () { return input.DeviceId; }, "{DeviceId}", false);
374
- return [2, new __HttpRequest({
375
- protocol: protocol,
376
- hostname: hostname,
377
- port: port,
378
- method: "POST",
379
- headers: headers,
380
- path: resolvedPath,
381
- body: body,
382
- })];
383
- }
384
- });
385
- }); };
386
- export var serializeAws_restJson1UnsubscribeFromDatasetCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
387
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
388
- return __generator(this, function (_c) {
389
- switch (_c.label) {
390
- case 0: return [4, context.endpoint()];
391
- case 1:
392
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
393
- headers = {};
394
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
395
- "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}";
396
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
397
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", function () { return input.IdentityId; }, "{IdentityId}", false);
398
- resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", function () { return input.DatasetName; }, "{DatasetName}", false);
399
- resolvedPath = __resolvedPath(resolvedPath, input, "DeviceId", function () { return input.DeviceId; }, "{DeviceId}", false);
400
- return [2, new __HttpRequest({
401
- protocol: protocol,
402
- hostname: hostname,
403
- port: port,
404
- method: "DELETE",
405
- headers: headers,
406
- path: resolvedPath,
407
- body: body,
408
- })];
409
- }
410
- });
411
- }); };
412
- export var serializeAws_restJson1UpdateRecordsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
413
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
414
- return __generator(this, function (_c) {
415
- switch (_c.label) {
416
- case 0: return [4, context.endpoint()];
417
- case 1:
418
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
419
- headers = map({}, isSerializableHeaderValue, {
420
- "content-type": "application/json",
421
- "x-amz-client-context": input.ClientContext,
422
- });
423
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
424
- "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}";
425
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", function () { return input.IdentityPoolId; }, "{IdentityPoolId}", false);
426
- resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", function () { return input.IdentityId; }, "{IdentityId}", false);
427
- resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", function () { return input.DatasetName; }, "{DatasetName}", false);
428
- body = JSON.stringify(__assign(__assign(__assign({}, (input.DeviceId != null && { DeviceId: input.DeviceId })), (input.RecordPatches != null && {
429
- RecordPatches: serializeAws_restJson1RecordPatchList(input.RecordPatches, context),
430
- })), (input.SyncSessionToken != null && { SyncSessionToken: input.SyncSessionToken })));
431
- return [2, new __HttpRequest({
432
- protocol: protocol,
433
- hostname: hostname,
434
- port: port,
435
- method: "POST",
436
- headers: headers,
437
- path: resolvedPath,
438
- body: body,
439
- })];
440
- }
5
+ export const serializeAws_restJson1BulkPublishCommand = async (input, context) => {
6
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
+ const headers = {};
8
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
9
+ "/identitypools/{IdentityPoolId}/bulkpublish";
10
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
11
+ let body;
12
+ return new __HttpRequest({
13
+ protocol,
14
+ hostname,
15
+ port,
16
+ method: "POST",
17
+ headers,
18
+ path: resolvedPath,
19
+ body,
441
20
  });
442
- }); };
443
- export var deserializeAws_restJson1BulkPublishCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
444
- var contents, data, _a, _b;
445
- return __generator(this, function (_c) {
446
- switch (_c.label) {
447
- case 0:
448
- if (output.statusCode !== 200 && output.statusCode >= 300) {
449
- return [2, deserializeAws_restJson1BulkPublishCommandError(output, context)];
450
- }
451
- contents = map({
452
- $metadata: deserializeMetadata(output),
453
- });
454
- _a = __expectNonNull;
455
- _b = __expectObject;
456
- return [4, parseBody(output.body, context)];
457
- case 1:
458
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
459
- if (data.IdentityPoolId != null) {
460
- contents.IdentityPoolId = __expectString(data.IdentityPoolId);
461
- }
462
- return [2, contents];
463
- }
464
- });
465
- }); };
466
- var deserializeAws_restJson1BulkPublishCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
467
- var parsedOutput, _a, errorCode, _b, parsedBody;
468
- var _c;
469
- return __generator(this, function (_d) {
470
- switch (_d.label) {
471
- case 0:
472
- _a = [__assign({}, output)];
473
- _c = {};
474
- return [4, parseErrorBody(output.body, context)];
475
- case 1:
476
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
477
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
478
- _b = errorCode;
479
- switch (_b) {
480
- case "AlreadyStreamedException": return [3, 2];
481
- case "com.amazonaws.cognitosync#AlreadyStreamedException": return [3, 2];
482
- case "DuplicateRequestException": return [3, 4];
483
- case "com.amazonaws.cognitosync#DuplicateRequestException": return [3, 4];
484
- case "InternalErrorException": return [3, 6];
485
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 6];
486
- case "InvalidParameterException": return [3, 8];
487
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 8];
488
- case "NotAuthorizedException": return [3, 10];
489
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 10];
490
- case "ResourceNotFoundException": return [3, 12];
491
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 12];
492
- }
493
- return [3, 14];
494
- case 2: return [4, deserializeAws_restJson1AlreadyStreamedExceptionResponse(parsedOutput, context)];
495
- case 3: throw _d.sent();
496
- case 4: return [4, deserializeAws_restJson1DuplicateRequestExceptionResponse(parsedOutput, context)];
497
- case 5: throw _d.sent();
498
- case 6: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
499
- case 7: throw _d.sent();
500
- case 8: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
501
- case 9: throw _d.sent();
502
- case 10: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
503
- case 11: throw _d.sent();
504
- case 12: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
505
- case 13: throw _d.sent();
506
- case 14:
507
- parsedBody = parsedOutput.body;
508
- throwDefaultError({
509
- output: output,
510
- parsedBody: parsedBody,
511
- exceptionCtor: __BaseException,
512
- errorCode: errorCode,
513
- });
514
- _d.label = 15;
515
- case 15: return [2];
516
- }
21
+ };
22
+ export const serializeAws_restJson1DeleteDatasetCommand = async (input, context) => {
23
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
24
+ const headers = {};
25
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
26
+ "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}";
27
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
28
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
29
+ resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
30
+ let body;
31
+ return new __HttpRequest({
32
+ protocol,
33
+ hostname,
34
+ port,
35
+ method: "DELETE",
36
+ headers,
37
+ path: resolvedPath,
38
+ body,
517
39
  });
518
- }); };
519
- export var deserializeAws_restJson1DeleteDatasetCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
520
- var contents, data, _a, _b;
521
- return __generator(this, function (_c) {
522
- switch (_c.label) {
523
- case 0:
524
- if (output.statusCode !== 200 && output.statusCode >= 300) {
525
- return [2, deserializeAws_restJson1DeleteDatasetCommandError(output, context)];
526
- }
527
- contents = map({
528
- $metadata: deserializeMetadata(output),
529
- });
530
- _a = __expectNonNull;
531
- _b = __expectObject;
532
- return [4, parseBody(output.body, context)];
533
- case 1:
534
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
535
- if (data.Dataset != null) {
536
- contents.Dataset = deserializeAws_restJson1Dataset(data.Dataset, context);
537
- }
538
- return [2, contents];
539
- }
40
+ };
41
+ export const serializeAws_restJson1DescribeDatasetCommand = async (input, context) => {
42
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
43
+ const headers = {};
44
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
45
+ "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}";
46
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
47
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
48
+ resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
49
+ let body;
50
+ return new __HttpRequest({
51
+ protocol,
52
+ hostname,
53
+ port,
54
+ method: "GET",
55
+ headers,
56
+ path: resolvedPath,
57
+ body,
540
58
  });
541
- }); };
542
- var deserializeAws_restJson1DeleteDatasetCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
543
- var parsedOutput, _a, errorCode, _b, parsedBody;
544
- var _c;
545
- return __generator(this, function (_d) {
546
- switch (_d.label) {
547
- case 0:
548
- _a = [__assign({}, output)];
549
- _c = {};
550
- return [4, parseErrorBody(output.body, context)];
551
- case 1:
552
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
553
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
554
- _b = errorCode;
555
- switch (_b) {
556
- case "InternalErrorException": return [3, 2];
557
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
558
- case "InvalidParameterException": return [3, 4];
559
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
560
- case "NotAuthorizedException": return [3, 6];
561
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
562
- case "ResourceConflictException": return [3, 8];
563
- case "com.amazonaws.cognitosync#ResourceConflictException": return [3, 8];
564
- case "ResourceNotFoundException": return [3, 10];
565
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 10];
566
- case "TooManyRequestsException": return [3, 12];
567
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 12];
568
- }
569
- return [3, 14];
570
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
571
- case 3: throw _d.sent();
572
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
573
- case 5: throw _d.sent();
574
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
575
- case 7: throw _d.sent();
576
- case 8: return [4, deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context)];
577
- case 9: throw _d.sent();
578
- case 10: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
579
- case 11: throw _d.sent();
580
- case 12: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
581
- case 13: throw _d.sent();
582
- case 14:
583
- parsedBody = parsedOutput.body;
584
- throwDefaultError({
585
- output: output,
586
- parsedBody: parsedBody,
587
- exceptionCtor: __BaseException,
588
- errorCode: errorCode,
589
- });
590
- _d.label = 15;
591
- case 15: return [2];
592
- }
59
+ };
60
+ export const serializeAws_restJson1DescribeIdentityPoolUsageCommand = async (input, context) => {
61
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
62
+ const headers = {};
63
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}";
64
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
65
+ let body;
66
+ return new __HttpRequest({
67
+ protocol,
68
+ hostname,
69
+ port,
70
+ method: "GET",
71
+ headers,
72
+ path: resolvedPath,
73
+ body,
593
74
  });
594
- }); };
595
- export var deserializeAws_restJson1DescribeDatasetCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
596
- var contents, data, _a, _b;
597
- return __generator(this, function (_c) {
598
- switch (_c.label) {
599
- case 0:
600
- if (output.statusCode !== 200 && output.statusCode >= 300) {
601
- return [2, deserializeAws_restJson1DescribeDatasetCommandError(output, context)];
602
- }
603
- contents = map({
604
- $metadata: deserializeMetadata(output),
605
- });
606
- _a = __expectNonNull;
607
- _b = __expectObject;
608
- return [4, parseBody(output.body, context)];
609
- case 1:
610
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
611
- if (data.Dataset != null) {
612
- contents.Dataset = deserializeAws_restJson1Dataset(data.Dataset, context);
613
- }
614
- return [2, contents];
615
- }
75
+ };
76
+ export const serializeAws_restJson1DescribeIdentityUsageCommand = async (input, context) => {
77
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
78
+ const headers = {};
79
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
80
+ "/identitypools/{IdentityPoolId}/identities/{IdentityId}";
81
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
82
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
83
+ let body;
84
+ return new __HttpRequest({
85
+ protocol,
86
+ hostname,
87
+ port,
88
+ method: "GET",
89
+ headers,
90
+ path: resolvedPath,
91
+ body,
616
92
  });
617
- }); };
618
- var deserializeAws_restJson1DescribeDatasetCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
619
- var parsedOutput, _a, errorCode, _b, parsedBody;
620
- var _c;
621
- return __generator(this, function (_d) {
622
- switch (_d.label) {
623
- case 0:
624
- _a = [__assign({}, output)];
625
- _c = {};
626
- return [4, parseErrorBody(output.body, context)];
627
- case 1:
628
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
629
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
630
- _b = errorCode;
631
- switch (_b) {
632
- case "InternalErrorException": return [3, 2];
633
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
634
- case "InvalidParameterException": return [3, 4];
635
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
636
- case "NotAuthorizedException": return [3, 6];
637
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
638
- case "ResourceNotFoundException": return [3, 8];
639
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 8];
640
- case "TooManyRequestsException": return [3, 10];
641
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 10];
642
- }
643
- return [3, 12];
644
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
645
- case 3: throw _d.sent();
646
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
647
- case 5: throw _d.sent();
648
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
649
- case 7: throw _d.sent();
650
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
651
- case 9: throw _d.sent();
652
- case 10: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
653
- case 11: throw _d.sent();
654
- case 12:
655
- parsedBody = parsedOutput.body;
656
- throwDefaultError({
657
- output: output,
658
- parsedBody: parsedBody,
659
- exceptionCtor: __BaseException,
660
- errorCode: errorCode,
661
- });
662
- _d.label = 13;
663
- case 13: return [2];
664
- }
93
+ };
94
+ export const serializeAws_restJson1GetBulkPublishDetailsCommand = async (input, context) => {
95
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
96
+ const headers = {};
97
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
98
+ "/identitypools/{IdentityPoolId}/getBulkPublishDetails";
99
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
100
+ let body;
101
+ return new __HttpRequest({
102
+ protocol,
103
+ hostname,
104
+ port,
105
+ method: "POST",
106
+ headers,
107
+ path: resolvedPath,
108
+ body,
665
109
  });
666
- }); };
667
- export var deserializeAws_restJson1DescribeIdentityPoolUsageCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
668
- var contents, data, _a, _b;
669
- return __generator(this, function (_c) {
670
- switch (_c.label) {
671
- case 0:
672
- if (output.statusCode !== 200 && output.statusCode >= 300) {
673
- return [2, deserializeAws_restJson1DescribeIdentityPoolUsageCommandError(output, context)];
674
- }
675
- contents = map({
676
- $metadata: deserializeMetadata(output),
677
- });
678
- _a = __expectNonNull;
679
- _b = __expectObject;
680
- return [4, parseBody(output.body, context)];
681
- case 1:
682
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
683
- if (data.IdentityPoolUsage != null) {
684
- contents.IdentityPoolUsage = deserializeAws_restJson1IdentityPoolUsage(data.IdentityPoolUsage, context);
685
- }
686
- return [2, contents];
687
- }
110
+ };
111
+ export const serializeAws_restJson1GetCognitoEventsCommand = async (input, context) => {
112
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
113
+ const headers = {};
114
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}/events";
115
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
116
+ let body;
117
+ return new __HttpRequest({
118
+ protocol,
119
+ hostname,
120
+ port,
121
+ method: "GET",
122
+ headers,
123
+ path: resolvedPath,
124
+ body,
688
125
  });
689
- }); };
690
- var deserializeAws_restJson1DescribeIdentityPoolUsageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
691
- var parsedOutput, _a, errorCode, _b, parsedBody;
692
- var _c;
693
- return __generator(this, function (_d) {
694
- switch (_d.label) {
695
- case 0:
696
- _a = [__assign({}, output)];
697
- _c = {};
698
- return [4, parseErrorBody(output.body, context)];
699
- case 1:
700
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
701
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
702
- _b = errorCode;
703
- switch (_b) {
704
- case "InternalErrorException": return [3, 2];
705
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
706
- case "InvalidParameterException": return [3, 4];
707
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
708
- case "NotAuthorizedException": return [3, 6];
709
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
710
- case "ResourceNotFoundException": return [3, 8];
711
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 8];
712
- case "TooManyRequestsException": return [3, 10];
713
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 10];
714
- }
715
- return [3, 12];
716
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
717
- case 3: throw _d.sent();
718
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
719
- case 5: throw _d.sent();
720
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
721
- case 7: throw _d.sent();
722
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
723
- case 9: throw _d.sent();
724
- case 10: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
725
- case 11: throw _d.sent();
726
- case 12:
727
- parsedBody = parsedOutput.body;
728
- throwDefaultError({
729
- output: output,
730
- parsedBody: parsedBody,
731
- exceptionCtor: __BaseException,
732
- errorCode: errorCode,
733
- });
734
- _d.label = 13;
735
- case 13: return [2];
736
- }
126
+ };
127
+ export const serializeAws_restJson1GetIdentityPoolConfigurationCommand = async (input, context) => {
128
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
129
+ const headers = {};
130
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
131
+ "/identitypools/{IdentityPoolId}/configuration";
132
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
133
+ let body;
134
+ return new __HttpRequest({
135
+ protocol,
136
+ hostname,
137
+ port,
138
+ method: "GET",
139
+ headers,
140
+ path: resolvedPath,
141
+ body,
737
142
  });
738
- }); };
739
- export var deserializeAws_restJson1DescribeIdentityUsageCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
740
- var contents, data, _a, _b;
741
- return __generator(this, function (_c) {
742
- switch (_c.label) {
743
- case 0:
744
- if (output.statusCode !== 200 && output.statusCode >= 300) {
745
- return [2, deserializeAws_restJson1DescribeIdentityUsageCommandError(output, context)];
746
- }
747
- contents = map({
748
- $metadata: deserializeMetadata(output),
749
- });
750
- _a = __expectNonNull;
751
- _b = __expectObject;
752
- return [4, parseBody(output.body, context)];
753
- case 1:
754
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
755
- if (data.IdentityUsage != null) {
756
- contents.IdentityUsage = deserializeAws_restJson1IdentityUsage(data.IdentityUsage, context);
757
- }
758
- return [2, contents];
759
- }
143
+ };
144
+ export const serializeAws_restJson1ListDatasetsCommand = async (input, context) => {
145
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
146
+ const headers = {};
147
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
148
+ "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets";
149
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
150
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
151
+ const query = map({
152
+ nextToken: [, input.NextToken],
153
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
154
+ });
155
+ let body;
156
+ return new __HttpRequest({
157
+ protocol,
158
+ hostname,
159
+ port,
160
+ method: "GET",
161
+ headers,
162
+ path: resolvedPath,
163
+ query,
164
+ body,
760
165
  });
761
- }); };
762
- var deserializeAws_restJson1DescribeIdentityUsageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
763
- var parsedOutput, _a, errorCode, _b, parsedBody;
764
- var _c;
765
- return __generator(this, function (_d) {
766
- switch (_d.label) {
767
- case 0:
768
- _a = [__assign({}, output)];
769
- _c = {};
770
- return [4, parseErrorBody(output.body, context)];
771
- case 1:
772
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
773
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
774
- _b = errorCode;
775
- switch (_b) {
776
- case "InternalErrorException": return [3, 2];
777
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
778
- case "InvalidParameterException": return [3, 4];
779
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
780
- case "NotAuthorizedException": return [3, 6];
781
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
782
- case "ResourceNotFoundException": return [3, 8];
783
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 8];
784
- case "TooManyRequestsException": return [3, 10];
785
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 10];
786
- }
787
- return [3, 12];
788
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
789
- case 3: throw _d.sent();
790
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
791
- case 5: throw _d.sent();
792
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
793
- case 7: throw _d.sent();
794
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
795
- case 9: throw _d.sent();
796
- case 10: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
797
- case 11: throw _d.sent();
798
- case 12:
799
- parsedBody = parsedOutput.body;
800
- throwDefaultError({
801
- output: output,
802
- parsedBody: parsedBody,
803
- exceptionCtor: __BaseException,
804
- errorCode: errorCode,
805
- });
806
- _d.label = 13;
807
- case 13: return [2];
808
- }
166
+ };
167
+ export const serializeAws_restJson1ListIdentityPoolUsageCommand = async (input, context) => {
168
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
169
+ const headers = {};
170
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools";
171
+ const query = map({
172
+ nextToken: [, input.NextToken],
173
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
174
+ });
175
+ let body;
176
+ return new __HttpRequest({
177
+ protocol,
178
+ hostname,
179
+ port,
180
+ method: "GET",
181
+ headers,
182
+ path: resolvedPath,
183
+ query,
184
+ body,
809
185
  });
810
- }); };
811
- export var deserializeAws_restJson1GetBulkPublishDetailsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
812
- var contents, data, _a, _b;
813
- return __generator(this, function (_c) {
814
- switch (_c.label) {
815
- case 0:
816
- if (output.statusCode !== 200 && output.statusCode >= 300) {
817
- return [2, deserializeAws_restJson1GetBulkPublishDetailsCommandError(output, context)];
818
- }
819
- contents = map({
820
- $metadata: deserializeMetadata(output),
821
- });
822
- _a = __expectNonNull;
823
- _b = __expectObject;
824
- return [4, parseBody(output.body, context)];
825
- case 1:
826
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
827
- if (data.BulkPublishCompleteTime != null) {
828
- contents.BulkPublishCompleteTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.BulkPublishCompleteTime)));
829
- }
830
- if (data.BulkPublishStartTime != null) {
831
- contents.BulkPublishStartTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.BulkPublishStartTime)));
832
- }
833
- if (data.BulkPublishStatus != null) {
834
- contents.BulkPublishStatus = __expectString(data.BulkPublishStatus);
835
- }
836
- if (data.FailureMessage != null) {
837
- contents.FailureMessage = __expectString(data.FailureMessage);
838
- }
839
- if (data.IdentityPoolId != null) {
840
- contents.IdentityPoolId = __expectString(data.IdentityPoolId);
841
- }
842
- return [2, contents];
843
- }
186
+ };
187
+ export const serializeAws_restJson1ListRecordsCommand = async (input, context) => {
188
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
189
+ const headers = {};
190
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
191
+ "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/records";
192
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
193
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
194
+ resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
195
+ const query = map({
196
+ lastSyncCount: [() => input.LastSyncCount !== void 0, () => input.LastSyncCount.toString()],
197
+ nextToken: [, input.NextToken],
198
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
199
+ syncSessionToken: [, input.SyncSessionToken],
200
+ });
201
+ let body;
202
+ return new __HttpRequest({
203
+ protocol,
204
+ hostname,
205
+ port,
206
+ method: "GET",
207
+ headers,
208
+ path: resolvedPath,
209
+ query,
210
+ body,
844
211
  });
845
- }); };
846
- var deserializeAws_restJson1GetBulkPublishDetailsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
847
- var parsedOutput, _a, errorCode, _b, parsedBody;
848
- var _c;
849
- return __generator(this, function (_d) {
850
- switch (_d.label) {
851
- case 0:
852
- _a = [__assign({}, output)];
853
- _c = {};
854
- return [4, parseErrorBody(output.body, context)];
855
- case 1:
856
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
857
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
858
- _b = errorCode;
859
- switch (_b) {
860
- case "InternalErrorException": return [3, 2];
861
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
862
- case "InvalidParameterException": return [3, 4];
863
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
864
- case "NotAuthorizedException": return [3, 6];
865
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
866
- case "ResourceNotFoundException": return [3, 8];
867
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 8];
868
- }
869
- return [3, 10];
870
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
871
- case 3: throw _d.sent();
872
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
873
- case 5: throw _d.sent();
874
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
875
- case 7: throw _d.sent();
876
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
877
- case 9: throw _d.sent();
878
- case 10:
879
- parsedBody = parsedOutput.body;
880
- throwDefaultError({
881
- output: output,
882
- parsedBody: parsedBody,
883
- exceptionCtor: __BaseException,
884
- errorCode: errorCode,
885
- });
886
- _d.label = 11;
887
- case 11: return [2];
888
- }
212
+ };
213
+ export const serializeAws_restJson1RegisterDeviceCommand = async (input, context) => {
214
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
215
+ const headers = {
216
+ "content-type": "application/json",
217
+ };
218
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
219
+ "/identitypools/{IdentityPoolId}/identity/{IdentityId}/device";
220
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
221
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
222
+ let body;
223
+ body = JSON.stringify({
224
+ ...(input.Platform != null && { Platform: input.Platform }),
225
+ ...(input.Token != null && { Token: input.Token }),
226
+ });
227
+ return new __HttpRequest({
228
+ protocol,
229
+ hostname,
230
+ port,
231
+ method: "POST",
232
+ headers,
233
+ path: resolvedPath,
234
+ body,
889
235
  });
890
- }); };
891
- export var deserializeAws_restJson1GetCognitoEventsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
892
- var contents, data, _a, _b;
893
- return __generator(this, function (_c) {
894
- switch (_c.label) {
895
- case 0:
896
- if (output.statusCode !== 200 && output.statusCode >= 300) {
897
- return [2, deserializeAws_restJson1GetCognitoEventsCommandError(output, context)];
898
- }
899
- contents = map({
900
- $metadata: deserializeMetadata(output),
901
- });
902
- _a = __expectNonNull;
903
- _b = __expectObject;
904
- return [4, parseBody(output.body, context)];
905
- case 1:
906
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
907
- if (data.Events != null) {
908
- contents.Events = deserializeAws_restJson1Events(data.Events, context);
909
- }
910
- return [2, contents];
911
- }
236
+ };
237
+ export const serializeAws_restJson1SetCognitoEventsCommand = async (input, context) => {
238
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
239
+ const headers = {
240
+ "content-type": "application/json",
241
+ };
242
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}/events";
243
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
244
+ let body;
245
+ body = JSON.stringify({
246
+ ...(input.Events != null && { Events: serializeAws_restJson1Events(input.Events, context) }),
247
+ });
248
+ return new __HttpRequest({
249
+ protocol,
250
+ hostname,
251
+ port,
252
+ method: "POST",
253
+ headers,
254
+ path: resolvedPath,
255
+ body,
912
256
  });
913
- }); };
914
- var deserializeAws_restJson1GetCognitoEventsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
915
- var parsedOutput, _a, errorCode, _b, parsedBody;
916
- var _c;
917
- return __generator(this, function (_d) {
918
- switch (_d.label) {
919
- case 0:
920
- _a = [__assign({}, output)];
921
- _c = {};
922
- return [4, parseErrorBody(output.body, context)];
923
- case 1:
924
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
925
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
926
- _b = errorCode;
927
- switch (_b) {
928
- case "InternalErrorException": return [3, 2];
929
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
930
- case "InvalidParameterException": return [3, 4];
931
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
932
- case "NotAuthorizedException": return [3, 6];
933
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
934
- case "ResourceNotFoundException": return [3, 8];
935
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 8];
936
- case "TooManyRequestsException": return [3, 10];
937
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 10];
938
- }
939
- return [3, 12];
940
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
941
- case 3: throw _d.sent();
942
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
943
- case 5: throw _d.sent();
944
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
945
- case 7: throw _d.sent();
946
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
947
- case 9: throw _d.sent();
948
- case 10: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
949
- case 11: throw _d.sent();
950
- case 12:
951
- parsedBody = parsedOutput.body;
952
- throwDefaultError({
953
- output: output,
954
- parsedBody: parsedBody,
955
- exceptionCtor: __BaseException,
956
- errorCode: errorCode,
957
- });
958
- _d.label = 13;
959
- case 13: return [2];
960
- }
257
+ };
258
+ export const serializeAws_restJson1SetIdentityPoolConfigurationCommand = async (input, context) => {
259
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
260
+ const headers = {
261
+ "content-type": "application/json",
262
+ };
263
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
264
+ "/identitypools/{IdentityPoolId}/configuration";
265
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
266
+ let body;
267
+ body = JSON.stringify({
268
+ ...(input.CognitoStreams != null && {
269
+ CognitoStreams: serializeAws_restJson1CognitoStreams(input.CognitoStreams, context),
270
+ }),
271
+ ...(input.PushSync != null && { PushSync: serializeAws_restJson1PushSync(input.PushSync, context) }),
272
+ });
273
+ return new __HttpRequest({
274
+ protocol,
275
+ hostname,
276
+ port,
277
+ method: "POST",
278
+ headers,
279
+ path: resolvedPath,
280
+ body,
961
281
  });
962
- }); };
963
- export var deserializeAws_restJson1GetIdentityPoolConfigurationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
964
- var contents, data, _a, _b;
965
- return __generator(this, function (_c) {
966
- switch (_c.label) {
967
- case 0:
968
- if (output.statusCode !== 200 && output.statusCode >= 300) {
969
- return [2, deserializeAws_restJson1GetIdentityPoolConfigurationCommandError(output, context)];
970
- }
971
- contents = map({
972
- $metadata: deserializeMetadata(output),
973
- });
974
- _a = __expectNonNull;
975
- _b = __expectObject;
976
- return [4, parseBody(output.body, context)];
977
- case 1:
978
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
979
- if (data.CognitoStreams != null) {
980
- contents.CognitoStreams = deserializeAws_restJson1CognitoStreams(data.CognitoStreams, context);
981
- }
982
- if (data.IdentityPoolId != null) {
983
- contents.IdentityPoolId = __expectString(data.IdentityPoolId);
984
- }
985
- if (data.PushSync != null) {
986
- contents.PushSync = deserializeAws_restJson1PushSync(data.PushSync, context);
987
- }
988
- return [2, contents];
989
- }
282
+ };
283
+ export const serializeAws_restJson1SubscribeToDatasetCommand = async (input, context) => {
284
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
285
+ const headers = {};
286
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
287
+ "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}";
288
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
289
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
290
+ resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
291
+ resolvedPath = __resolvedPath(resolvedPath, input, "DeviceId", () => input.DeviceId, "{DeviceId}", false);
292
+ let body;
293
+ return new __HttpRequest({
294
+ protocol,
295
+ hostname,
296
+ port,
297
+ method: "POST",
298
+ headers,
299
+ path: resolvedPath,
300
+ body,
990
301
  });
991
- }); };
992
- var deserializeAws_restJson1GetIdentityPoolConfigurationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
993
- var parsedOutput, _a, errorCode, _b, parsedBody;
994
- var _c;
995
- return __generator(this, function (_d) {
996
- switch (_d.label) {
997
- case 0:
998
- _a = [__assign({}, output)];
999
- _c = {};
1000
- return [4, parseErrorBody(output.body, context)];
1001
- case 1:
1002
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1003
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1004
- _b = errorCode;
1005
- switch (_b) {
1006
- case "InternalErrorException": return [3, 2];
1007
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
1008
- case "InvalidParameterException": return [3, 4];
1009
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
1010
- case "NotAuthorizedException": return [3, 6];
1011
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
1012
- case "ResourceNotFoundException": return [3, 8];
1013
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 8];
1014
- case "TooManyRequestsException": return [3, 10];
1015
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 10];
1016
- }
1017
- return [3, 12];
1018
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1019
- case 3: throw _d.sent();
1020
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1021
- case 5: throw _d.sent();
1022
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1023
- case 7: throw _d.sent();
1024
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1025
- case 9: throw _d.sent();
1026
- case 10: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1027
- case 11: throw _d.sent();
1028
- case 12:
1029
- parsedBody = parsedOutput.body;
1030
- throwDefaultError({
1031
- output: output,
1032
- parsedBody: parsedBody,
1033
- exceptionCtor: __BaseException,
1034
- errorCode: errorCode,
1035
- });
1036
- _d.label = 13;
1037
- case 13: return [2];
1038
- }
302
+ };
303
+ export const serializeAws_restJson1UnsubscribeFromDatasetCommand = async (input, context) => {
304
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
305
+ const headers = {};
306
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
307
+ "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}";
308
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
309
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
310
+ resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
311
+ resolvedPath = __resolvedPath(resolvedPath, input, "DeviceId", () => input.DeviceId, "{DeviceId}", false);
312
+ let body;
313
+ return new __HttpRequest({
314
+ protocol,
315
+ hostname,
316
+ port,
317
+ method: "DELETE",
318
+ headers,
319
+ path: resolvedPath,
320
+ body,
1039
321
  });
1040
- }); };
1041
- export var deserializeAws_restJson1ListDatasetsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1042
- var contents, data, _a, _b;
1043
- return __generator(this, function (_c) {
1044
- switch (_c.label) {
1045
- case 0:
1046
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1047
- return [2, deserializeAws_restJson1ListDatasetsCommandError(output, context)];
1048
- }
1049
- contents = map({
1050
- $metadata: deserializeMetadata(output),
1051
- });
1052
- _a = __expectNonNull;
1053
- _b = __expectObject;
1054
- return [4, parseBody(output.body, context)];
1055
- case 1:
1056
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1057
- if (data.Count != null) {
1058
- contents.Count = __expectInt32(data.Count);
1059
- }
1060
- if (data.Datasets != null) {
1061
- contents.Datasets = deserializeAws_restJson1DatasetList(data.Datasets, context);
1062
- }
1063
- if (data.NextToken != null) {
1064
- contents.NextToken = __expectString(data.NextToken);
1065
- }
1066
- return [2, contents];
1067
- }
322
+ };
323
+ export const serializeAws_restJson1UpdateRecordsCommand = async (input, context) => {
324
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
325
+ const headers = map({}, isSerializableHeaderValue, {
326
+ "content-type": "application/json",
327
+ "x-amz-client-context": input.ClientContext,
328
+ });
329
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
330
+ "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}";
331
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
332
+ resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
333
+ resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
334
+ let body;
335
+ body = JSON.stringify({
336
+ ...(input.DeviceId != null && { DeviceId: input.DeviceId }),
337
+ ...(input.RecordPatches != null && {
338
+ RecordPatches: serializeAws_restJson1RecordPatchList(input.RecordPatches, context),
339
+ }),
340
+ ...(input.SyncSessionToken != null && { SyncSessionToken: input.SyncSessionToken }),
341
+ });
342
+ return new __HttpRequest({
343
+ protocol,
344
+ hostname,
345
+ port,
346
+ method: "POST",
347
+ headers,
348
+ path: resolvedPath,
349
+ body,
1068
350
  });
1069
- }); };
1070
- var deserializeAws_restJson1ListDatasetsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1071
- var parsedOutput, _a, errorCode, _b, parsedBody;
1072
- var _c;
1073
- return __generator(this, function (_d) {
1074
- switch (_d.label) {
1075
- case 0:
1076
- _a = [__assign({}, output)];
1077
- _c = {};
1078
- return [4, parseErrorBody(output.body, context)];
1079
- case 1:
1080
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1081
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1082
- _b = errorCode;
1083
- switch (_b) {
1084
- case "InternalErrorException": return [3, 2];
1085
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
1086
- case "InvalidParameterException": return [3, 4];
1087
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
1088
- case "NotAuthorizedException": return [3, 6];
1089
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
1090
- case "TooManyRequestsException": return [3, 8];
1091
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 8];
1092
- }
1093
- return [3, 10];
1094
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1095
- case 3: throw _d.sent();
1096
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1097
- case 5: throw _d.sent();
1098
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1099
- case 7: throw _d.sent();
1100
- case 8: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1101
- case 9: throw _d.sent();
1102
- case 10:
1103
- parsedBody = parsedOutput.body;
1104
- throwDefaultError({
1105
- output: output,
1106
- parsedBody: parsedBody,
1107
- exceptionCtor: __BaseException,
1108
- errorCode: errorCode,
1109
- });
1110
- _d.label = 11;
1111
- case 11: return [2];
1112
- }
351
+ };
352
+ export const deserializeAws_restJson1BulkPublishCommand = async (output, context) => {
353
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
354
+ return deserializeAws_restJson1BulkPublishCommandError(output, context);
355
+ }
356
+ const contents = map({
357
+ $metadata: deserializeMetadata(output),
1113
358
  });
1114
- }); };
1115
- export var deserializeAws_restJson1ListIdentityPoolUsageCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1116
- var contents, data, _a, _b;
1117
- return __generator(this, function (_c) {
1118
- switch (_c.label) {
1119
- case 0:
1120
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1121
- return [2, deserializeAws_restJson1ListIdentityPoolUsageCommandError(output, context)];
1122
- }
1123
- contents = map({
1124
- $metadata: deserializeMetadata(output),
1125
- });
1126
- _a = __expectNonNull;
1127
- _b = __expectObject;
1128
- return [4, parseBody(output.body, context)];
1129
- case 1:
1130
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1131
- if (data.Count != null) {
1132
- contents.Count = __expectInt32(data.Count);
1133
- }
1134
- if (data.IdentityPoolUsages != null) {
1135
- contents.IdentityPoolUsages = deserializeAws_restJson1IdentityPoolUsageList(data.IdentityPoolUsages, context);
1136
- }
1137
- if (data.MaxResults != null) {
1138
- contents.MaxResults = __expectInt32(data.MaxResults);
1139
- }
1140
- if (data.NextToken != null) {
1141
- contents.NextToken = __expectString(data.NextToken);
1142
- }
1143
- return [2, contents];
1144
- }
359
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
360
+ if (data.IdentityPoolId != null) {
361
+ contents.IdentityPoolId = __expectString(data.IdentityPoolId);
362
+ }
363
+ return contents;
364
+ };
365
+ const deserializeAws_restJson1BulkPublishCommandError = async (output, context) => {
366
+ const parsedOutput = {
367
+ ...output,
368
+ body: await parseErrorBody(output.body, context),
369
+ };
370
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
371
+ switch (errorCode) {
372
+ case "AlreadyStreamedException":
373
+ case "com.amazonaws.cognitosync#AlreadyStreamedException":
374
+ throw await deserializeAws_restJson1AlreadyStreamedExceptionResponse(parsedOutput, context);
375
+ case "DuplicateRequestException":
376
+ case "com.amazonaws.cognitosync#DuplicateRequestException":
377
+ throw await deserializeAws_restJson1DuplicateRequestExceptionResponse(parsedOutput, context);
378
+ case "InternalErrorException":
379
+ case "com.amazonaws.cognitosync#InternalErrorException":
380
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
381
+ case "InvalidParameterException":
382
+ case "com.amazonaws.cognitosync#InvalidParameterException":
383
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
384
+ case "NotAuthorizedException":
385
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
386
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
387
+ case "ResourceNotFoundException":
388
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
389
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
390
+ default:
391
+ const parsedBody = parsedOutput.body;
392
+ throwDefaultError({
393
+ output,
394
+ parsedBody,
395
+ exceptionCtor: __BaseException,
396
+ errorCode,
397
+ });
398
+ }
399
+ };
400
+ export const deserializeAws_restJson1DeleteDatasetCommand = async (output, context) => {
401
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
402
+ return deserializeAws_restJson1DeleteDatasetCommandError(output, context);
403
+ }
404
+ const contents = map({
405
+ $metadata: deserializeMetadata(output),
1145
406
  });
1146
- }); };
1147
- var deserializeAws_restJson1ListIdentityPoolUsageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1148
- var parsedOutput, _a, errorCode, _b, parsedBody;
1149
- var _c;
1150
- return __generator(this, function (_d) {
1151
- switch (_d.label) {
1152
- case 0:
1153
- _a = [__assign({}, output)];
1154
- _c = {};
1155
- return [4, parseErrorBody(output.body, context)];
1156
- case 1:
1157
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1158
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1159
- _b = errorCode;
1160
- switch (_b) {
1161
- case "InternalErrorException": return [3, 2];
1162
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
1163
- case "InvalidParameterException": return [3, 4];
1164
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
1165
- case "NotAuthorizedException": return [3, 6];
1166
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
1167
- case "TooManyRequestsException": return [3, 8];
1168
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 8];
1169
- }
1170
- return [3, 10];
1171
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1172
- case 3: throw _d.sent();
1173
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1174
- case 5: throw _d.sent();
1175
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1176
- case 7: throw _d.sent();
1177
- case 8: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1178
- case 9: throw _d.sent();
1179
- case 10:
1180
- parsedBody = parsedOutput.body;
1181
- throwDefaultError({
1182
- output: output,
1183
- parsedBody: parsedBody,
1184
- exceptionCtor: __BaseException,
1185
- errorCode: errorCode,
1186
- });
1187
- _d.label = 11;
1188
- case 11: return [2];
1189
- }
407
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
408
+ if (data.Dataset != null) {
409
+ contents.Dataset = deserializeAws_restJson1Dataset(data.Dataset, context);
410
+ }
411
+ return contents;
412
+ };
413
+ const deserializeAws_restJson1DeleteDatasetCommandError = async (output, context) => {
414
+ const parsedOutput = {
415
+ ...output,
416
+ body: await parseErrorBody(output.body, context),
417
+ };
418
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
419
+ switch (errorCode) {
420
+ case "InternalErrorException":
421
+ case "com.amazonaws.cognitosync#InternalErrorException":
422
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
423
+ case "InvalidParameterException":
424
+ case "com.amazonaws.cognitosync#InvalidParameterException":
425
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
426
+ case "NotAuthorizedException":
427
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
428
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
429
+ case "ResourceConflictException":
430
+ case "com.amazonaws.cognitosync#ResourceConflictException":
431
+ throw await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context);
432
+ case "ResourceNotFoundException":
433
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
434
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
435
+ case "TooManyRequestsException":
436
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
437
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
438
+ default:
439
+ const parsedBody = parsedOutput.body;
440
+ throwDefaultError({
441
+ output,
442
+ parsedBody,
443
+ exceptionCtor: __BaseException,
444
+ errorCode,
445
+ });
446
+ }
447
+ };
448
+ export const deserializeAws_restJson1DescribeDatasetCommand = async (output, context) => {
449
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
450
+ return deserializeAws_restJson1DescribeDatasetCommandError(output, context);
451
+ }
452
+ const contents = map({
453
+ $metadata: deserializeMetadata(output),
1190
454
  });
1191
- }); };
1192
- export var deserializeAws_restJson1ListRecordsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1193
- var contents, data, _a, _b;
1194
- return __generator(this, function (_c) {
1195
- switch (_c.label) {
1196
- case 0:
1197
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1198
- return [2, deserializeAws_restJson1ListRecordsCommandError(output, context)];
1199
- }
1200
- contents = map({
1201
- $metadata: deserializeMetadata(output),
1202
- });
1203
- _a = __expectNonNull;
1204
- _b = __expectObject;
1205
- return [4, parseBody(output.body, context)];
1206
- case 1:
1207
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1208
- if (data.Count != null) {
1209
- contents.Count = __expectInt32(data.Count);
1210
- }
1211
- if (data.DatasetDeletedAfterRequestedSyncCount != null) {
1212
- contents.DatasetDeletedAfterRequestedSyncCount = __expectBoolean(data.DatasetDeletedAfterRequestedSyncCount);
1213
- }
1214
- if (data.DatasetExists != null) {
1215
- contents.DatasetExists = __expectBoolean(data.DatasetExists);
1216
- }
1217
- if (data.DatasetSyncCount != null) {
1218
- contents.DatasetSyncCount = __expectLong(data.DatasetSyncCount);
1219
- }
1220
- if (data.LastModifiedBy != null) {
1221
- contents.LastModifiedBy = __expectString(data.LastModifiedBy);
1222
- }
1223
- if (data.MergedDatasetNames != null) {
1224
- contents.MergedDatasetNames = deserializeAws_restJson1MergedDatasetNameList(data.MergedDatasetNames, context);
1225
- }
1226
- if (data.NextToken != null) {
1227
- contents.NextToken = __expectString(data.NextToken);
1228
- }
1229
- if (data.Records != null) {
1230
- contents.Records = deserializeAws_restJson1RecordList(data.Records, context);
1231
- }
1232
- if (data.SyncSessionToken != null) {
1233
- contents.SyncSessionToken = __expectString(data.SyncSessionToken);
1234
- }
1235
- return [2, contents];
1236
- }
455
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
456
+ if (data.Dataset != null) {
457
+ contents.Dataset = deserializeAws_restJson1Dataset(data.Dataset, context);
458
+ }
459
+ return contents;
460
+ };
461
+ const deserializeAws_restJson1DescribeDatasetCommandError = async (output, context) => {
462
+ const parsedOutput = {
463
+ ...output,
464
+ body: await parseErrorBody(output.body, context),
465
+ };
466
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
467
+ switch (errorCode) {
468
+ case "InternalErrorException":
469
+ case "com.amazonaws.cognitosync#InternalErrorException":
470
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
471
+ case "InvalidParameterException":
472
+ case "com.amazonaws.cognitosync#InvalidParameterException":
473
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
474
+ case "NotAuthorizedException":
475
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
476
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
477
+ case "ResourceNotFoundException":
478
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
479
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
480
+ case "TooManyRequestsException":
481
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
482
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
483
+ default:
484
+ const parsedBody = parsedOutput.body;
485
+ throwDefaultError({
486
+ output,
487
+ parsedBody,
488
+ exceptionCtor: __BaseException,
489
+ errorCode,
490
+ });
491
+ }
492
+ };
493
+ export const deserializeAws_restJson1DescribeIdentityPoolUsageCommand = async (output, context) => {
494
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
495
+ return deserializeAws_restJson1DescribeIdentityPoolUsageCommandError(output, context);
496
+ }
497
+ const contents = map({
498
+ $metadata: deserializeMetadata(output),
1237
499
  });
1238
- }); };
1239
- var deserializeAws_restJson1ListRecordsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1240
- var parsedOutput, _a, errorCode, _b, parsedBody;
1241
- var _c;
1242
- return __generator(this, function (_d) {
1243
- switch (_d.label) {
1244
- case 0:
1245
- _a = [__assign({}, output)];
1246
- _c = {};
1247
- return [4, parseErrorBody(output.body, context)];
1248
- case 1:
1249
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1250
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1251
- _b = errorCode;
1252
- switch (_b) {
1253
- case "InternalErrorException": return [3, 2];
1254
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
1255
- case "InvalidParameterException": return [3, 4];
1256
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
1257
- case "NotAuthorizedException": return [3, 6];
1258
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
1259
- case "TooManyRequestsException": return [3, 8];
1260
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 8];
1261
- }
1262
- return [3, 10];
1263
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1264
- case 3: throw _d.sent();
1265
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1266
- case 5: throw _d.sent();
1267
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1268
- case 7: throw _d.sent();
1269
- case 8: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1270
- case 9: throw _d.sent();
1271
- case 10:
1272
- parsedBody = parsedOutput.body;
1273
- throwDefaultError({
1274
- output: output,
1275
- parsedBody: parsedBody,
1276
- exceptionCtor: __BaseException,
1277
- errorCode: errorCode,
1278
- });
1279
- _d.label = 11;
1280
- case 11: return [2];
1281
- }
500
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
501
+ if (data.IdentityPoolUsage != null) {
502
+ contents.IdentityPoolUsage = deserializeAws_restJson1IdentityPoolUsage(data.IdentityPoolUsage, context);
503
+ }
504
+ return contents;
505
+ };
506
+ const deserializeAws_restJson1DescribeIdentityPoolUsageCommandError = async (output, context) => {
507
+ const parsedOutput = {
508
+ ...output,
509
+ body: await parseErrorBody(output.body, context),
510
+ };
511
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
512
+ switch (errorCode) {
513
+ case "InternalErrorException":
514
+ case "com.amazonaws.cognitosync#InternalErrorException":
515
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
516
+ case "InvalidParameterException":
517
+ case "com.amazonaws.cognitosync#InvalidParameterException":
518
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
519
+ case "NotAuthorizedException":
520
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
521
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
522
+ case "ResourceNotFoundException":
523
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
524
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
525
+ case "TooManyRequestsException":
526
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
527
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
528
+ default:
529
+ const parsedBody = parsedOutput.body;
530
+ throwDefaultError({
531
+ output,
532
+ parsedBody,
533
+ exceptionCtor: __BaseException,
534
+ errorCode,
535
+ });
536
+ }
537
+ };
538
+ export const deserializeAws_restJson1DescribeIdentityUsageCommand = async (output, context) => {
539
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
540
+ return deserializeAws_restJson1DescribeIdentityUsageCommandError(output, context);
541
+ }
542
+ const contents = map({
543
+ $metadata: deserializeMetadata(output),
1282
544
  });
1283
- }); };
1284
- export var deserializeAws_restJson1RegisterDeviceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1285
- var contents, data, _a, _b;
1286
- return __generator(this, function (_c) {
1287
- switch (_c.label) {
1288
- case 0:
1289
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1290
- return [2, deserializeAws_restJson1RegisterDeviceCommandError(output, context)];
1291
- }
1292
- contents = map({
1293
- $metadata: deserializeMetadata(output),
1294
- });
1295
- _a = __expectNonNull;
1296
- _b = __expectObject;
1297
- return [4, parseBody(output.body, context)];
1298
- case 1:
1299
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1300
- if (data.DeviceId != null) {
1301
- contents.DeviceId = __expectString(data.DeviceId);
1302
- }
1303
- return [2, contents];
1304
- }
545
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
546
+ if (data.IdentityUsage != null) {
547
+ contents.IdentityUsage = deserializeAws_restJson1IdentityUsage(data.IdentityUsage, context);
548
+ }
549
+ return contents;
550
+ };
551
+ const deserializeAws_restJson1DescribeIdentityUsageCommandError = async (output, context) => {
552
+ const parsedOutput = {
553
+ ...output,
554
+ body: await parseErrorBody(output.body, context),
555
+ };
556
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
557
+ switch (errorCode) {
558
+ case "InternalErrorException":
559
+ case "com.amazonaws.cognitosync#InternalErrorException":
560
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
561
+ case "InvalidParameterException":
562
+ case "com.amazonaws.cognitosync#InvalidParameterException":
563
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
564
+ case "NotAuthorizedException":
565
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
566
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
567
+ case "ResourceNotFoundException":
568
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
569
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
570
+ case "TooManyRequestsException":
571
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
572
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
573
+ default:
574
+ const parsedBody = parsedOutput.body;
575
+ throwDefaultError({
576
+ output,
577
+ parsedBody,
578
+ exceptionCtor: __BaseException,
579
+ errorCode,
580
+ });
581
+ }
582
+ };
583
+ export const deserializeAws_restJson1GetBulkPublishDetailsCommand = async (output, context) => {
584
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
585
+ return deserializeAws_restJson1GetBulkPublishDetailsCommandError(output, context);
586
+ }
587
+ const contents = map({
588
+ $metadata: deserializeMetadata(output),
1305
589
  });
1306
- }); };
1307
- var deserializeAws_restJson1RegisterDeviceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1308
- var parsedOutput, _a, errorCode, _b, parsedBody;
1309
- var _c;
1310
- return __generator(this, function (_d) {
1311
- switch (_d.label) {
1312
- case 0:
1313
- _a = [__assign({}, output)];
1314
- _c = {};
1315
- return [4, parseErrorBody(output.body, context)];
1316
- case 1:
1317
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1318
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1319
- _b = errorCode;
1320
- switch (_b) {
1321
- case "InternalErrorException": return [3, 2];
1322
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
1323
- case "InvalidConfigurationException": return [3, 4];
1324
- case "com.amazonaws.cognitosync#InvalidConfigurationException": return [3, 4];
1325
- case "InvalidParameterException": return [3, 6];
1326
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 6];
1327
- case "NotAuthorizedException": return [3, 8];
1328
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 8];
1329
- case "ResourceNotFoundException": return [3, 10];
1330
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 10];
1331
- case "TooManyRequestsException": return [3, 12];
1332
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 12];
1333
- }
1334
- return [3, 14];
1335
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1336
- case 3: throw _d.sent();
1337
- case 4: return [4, deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context)];
1338
- case 5: throw _d.sent();
1339
- case 6: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1340
- case 7: throw _d.sent();
1341
- case 8: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1342
- case 9: throw _d.sent();
1343
- case 10: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1344
- case 11: throw _d.sent();
1345
- case 12: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1346
- case 13: throw _d.sent();
1347
- case 14:
1348
- parsedBody = parsedOutput.body;
1349
- throwDefaultError({
1350
- output: output,
1351
- parsedBody: parsedBody,
1352
- exceptionCtor: __BaseException,
1353
- errorCode: errorCode,
1354
- });
1355
- _d.label = 15;
1356
- case 15: return [2];
1357
- }
590
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
591
+ if (data.BulkPublishCompleteTime != null) {
592
+ contents.BulkPublishCompleteTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.BulkPublishCompleteTime)));
593
+ }
594
+ if (data.BulkPublishStartTime != null) {
595
+ contents.BulkPublishStartTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.BulkPublishStartTime)));
596
+ }
597
+ if (data.BulkPublishStatus != null) {
598
+ contents.BulkPublishStatus = __expectString(data.BulkPublishStatus);
599
+ }
600
+ if (data.FailureMessage != null) {
601
+ contents.FailureMessage = __expectString(data.FailureMessage);
602
+ }
603
+ if (data.IdentityPoolId != null) {
604
+ contents.IdentityPoolId = __expectString(data.IdentityPoolId);
605
+ }
606
+ return contents;
607
+ };
608
+ const deserializeAws_restJson1GetBulkPublishDetailsCommandError = async (output, context) => {
609
+ const parsedOutput = {
610
+ ...output,
611
+ body: await parseErrorBody(output.body, context),
612
+ };
613
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
614
+ switch (errorCode) {
615
+ case "InternalErrorException":
616
+ case "com.amazonaws.cognitosync#InternalErrorException":
617
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
618
+ case "InvalidParameterException":
619
+ case "com.amazonaws.cognitosync#InvalidParameterException":
620
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
621
+ case "NotAuthorizedException":
622
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
623
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
624
+ case "ResourceNotFoundException":
625
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
626
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
627
+ default:
628
+ const parsedBody = parsedOutput.body;
629
+ throwDefaultError({
630
+ output,
631
+ parsedBody,
632
+ exceptionCtor: __BaseException,
633
+ errorCode,
634
+ });
635
+ }
636
+ };
637
+ export const deserializeAws_restJson1GetCognitoEventsCommand = async (output, context) => {
638
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
639
+ return deserializeAws_restJson1GetCognitoEventsCommandError(output, context);
640
+ }
641
+ const contents = map({
642
+ $metadata: deserializeMetadata(output),
1358
643
  });
1359
- }); };
1360
- export var deserializeAws_restJson1SetCognitoEventsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1361
- var contents;
1362
- return __generator(this, function (_a) {
1363
- switch (_a.label) {
1364
- case 0:
1365
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1366
- return [2, deserializeAws_restJson1SetCognitoEventsCommandError(output, context)];
1367
- }
1368
- contents = map({
1369
- $metadata: deserializeMetadata(output),
1370
- });
1371
- return [4, collectBody(output.body, context)];
1372
- case 1:
1373
- _a.sent();
1374
- return [2, contents];
1375
- }
644
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
645
+ if (data.Events != null) {
646
+ contents.Events = deserializeAws_restJson1Events(data.Events, context);
647
+ }
648
+ return contents;
649
+ };
650
+ const deserializeAws_restJson1GetCognitoEventsCommandError = async (output, context) => {
651
+ const parsedOutput = {
652
+ ...output,
653
+ body: await parseErrorBody(output.body, context),
654
+ };
655
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
656
+ switch (errorCode) {
657
+ case "InternalErrorException":
658
+ case "com.amazonaws.cognitosync#InternalErrorException":
659
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
660
+ case "InvalidParameterException":
661
+ case "com.amazonaws.cognitosync#InvalidParameterException":
662
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
663
+ case "NotAuthorizedException":
664
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
665
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
666
+ case "ResourceNotFoundException":
667
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
668
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
669
+ case "TooManyRequestsException":
670
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
671
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
672
+ default:
673
+ const parsedBody = parsedOutput.body;
674
+ throwDefaultError({
675
+ output,
676
+ parsedBody,
677
+ exceptionCtor: __BaseException,
678
+ errorCode,
679
+ });
680
+ }
681
+ };
682
+ export const deserializeAws_restJson1GetIdentityPoolConfigurationCommand = async (output, context) => {
683
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
684
+ return deserializeAws_restJson1GetIdentityPoolConfigurationCommandError(output, context);
685
+ }
686
+ const contents = map({
687
+ $metadata: deserializeMetadata(output),
1376
688
  });
1377
- }); };
1378
- var deserializeAws_restJson1SetCognitoEventsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1379
- var parsedOutput, _a, errorCode, _b, parsedBody;
1380
- var _c;
1381
- return __generator(this, function (_d) {
1382
- switch (_d.label) {
1383
- case 0:
1384
- _a = [__assign({}, output)];
1385
- _c = {};
1386
- return [4, parseErrorBody(output.body, context)];
1387
- case 1:
1388
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1389
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1390
- _b = errorCode;
1391
- switch (_b) {
1392
- case "InternalErrorException": return [3, 2];
1393
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
1394
- case "InvalidParameterException": return [3, 4];
1395
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 4];
1396
- case "NotAuthorizedException": return [3, 6];
1397
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 6];
1398
- case "ResourceNotFoundException": return [3, 8];
1399
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 8];
1400
- case "TooManyRequestsException": return [3, 10];
1401
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 10];
1402
- }
1403
- return [3, 12];
1404
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1405
- case 3: throw _d.sent();
1406
- case 4: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1407
- case 5: throw _d.sent();
1408
- case 6: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1409
- case 7: throw _d.sent();
1410
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1411
- case 9: throw _d.sent();
1412
- case 10: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1413
- case 11: throw _d.sent();
1414
- case 12:
1415
- parsedBody = parsedOutput.body;
1416
- throwDefaultError({
1417
- output: output,
1418
- parsedBody: parsedBody,
1419
- exceptionCtor: __BaseException,
1420
- errorCode: errorCode,
1421
- });
1422
- _d.label = 13;
1423
- case 13: return [2];
1424
- }
689
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
690
+ if (data.CognitoStreams != null) {
691
+ contents.CognitoStreams = deserializeAws_restJson1CognitoStreams(data.CognitoStreams, context);
692
+ }
693
+ if (data.IdentityPoolId != null) {
694
+ contents.IdentityPoolId = __expectString(data.IdentityPoolId);
695
+ }
696
+ if (data.PushSync != null) {
697
+ contents.PushSync = deserializeAws_restJson1PushSync(data.PushSync, context);
698
+ }
699
+ return contents;
700
+ };
701
+ const deserializeAws_restJson1GetIdentityPoolConfigurationCommandError = async (output, context) => {
702
+ const parsedOutput = {
703
+ ...output,
704
+ body: await parseErrorBody(output.body, context),
705
+ };
706
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
707
+ switch (errorCode) {
708
+ case "InternalErrorException":
709
+ case "com.amazonaws.cognitosync#InternalErrorException":
710
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
711
+ case "InvalidParameterException":
712
+ case "com.amazonaws.cognitosync#InvalidParameterException":
713
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
714
+ case "NotAuthorizedException":
715
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
716
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
717
+ case "ResourceNotFoundException":
718
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
719
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
720
+ case "TooManyRequestsException":
721
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
722
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
723
+ default:
724
+ const parsedBody = parsedOutput.body;
725
+ throwDefaultError({
726
+ output,
727
+ parsedBody,
728
+ exceptionCtor: __BaseException,
729
+ errorCode,
730
+ });
731
+ }
732
+ };
733
+ export const deserializeAws_restJson1ListDatasetsCommand = async (output, context) => {
734
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
735
+ return deserializeAws_restJson1ListDatasetsCommandError(output, context);
736
+ }
737
+ const contents = map({
738
+ $metadata: deserializeMetadata(output),
1425
739
  });
1426
- }); };
1427
- export var deserializeAws_restJson1SetIdentityPoolConfigurationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1428
- var contents, data, _a, _b;
1429
- return __generator(this, function (_c) {
1430
- switch (_c.label) {
1431
- case 0:
1432
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1433
- return [2, deserializeAws_restJson1SetIdentityPoolConfigurationCommandError(output, context)];
1434
- }
1435
- contents = map({
1436
- $metadata: deserializeMetadata(output),
1437
- });
1438
- _a = __expectNonNull;
1439
- _b = __expectObject;
1440
- return [4, parseBody(output.body, context)];
1441
- case 1:
1442
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1443
- if (data.CognitoStreams != null) {
1444
- contents.CognitoStreams = deserializeAws_restJson1CognitoStreams(data.CognitoStreams, context);
1445
- }
1446
- if (data.IdentityPoolId != null) {
1447
- contents.IdentityPoolId = __expectString(data.IdentityPoolId);
1448
- }
1449
- if (data.PushSync != null) {
1450
- contents.PushSync = deserializeAws_restJson1PushSync(data.PushSync, context);
1451
- }
1452
- return [2, contents];
1453
- }
740
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
741
+ if (data.Count != null) {
742
+ contents.Count = __expectInt32(data.Count);
743
+ }
744
+ if (data.Datasets != null) {
745
+ contents.Datasets = deserializeAws_restJson1DatasetList(data.Datasets, context);
746
+ }
747
+ if (data.NextToken != null) {
748
+ contents.NextToken = __expectString(data.NextToken);
749
+ }
750
+ return contents;
751
+ };
752
+ const deserializeAws_restJson1ListDatasetsCommandError = async (output, context) => {
753
+ const parsedOutput = {
754
+ ...output,
755
+ body: await parseErrorBody(output.body, context),
756
+ };
757
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
758
+ switch (errorCode) {
759
+ case "InternalErrorException":
760
+ case "com.amazonaws.cognitosync#InternalErrorException":
761
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
762
+ case "InvalidParameterException":
763
+ case "com.amazonaws.cognitosync#InvalidParameterException":
764
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
765
+ case "NotAuthorizedException":
766
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
767
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
768
+ case "TooManyRequestsException":
769
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
770
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
771
+ default:
772
+ const parsedBody = parsedOutput.body;
773
+ throwDefaultError({
774
+ output,
775
+ parsedBody,
776
+ exceptionCtor: __BaseException,
777
+ errorCode,
778
+ });
779
+ }
780
+ };
781
+ export const deserializeAws_restJson1ListIdentityPoolUsageCommand = async (output, context) => {
782
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
783
+ return deserializeAws_restJson1ListIdentityPoolUsageCommandError(output, context);
784
+ }
785
+ const contents = map({
786
+ $metadata: deserializeMetadata(output),
1454
787
  });
1455
- }); };
1456
- var deserializeAws_restJson1SetIdentityPoolConfigurationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1457
- var parsedOutput, _a, errorCode, _b, parsedBody;
1458
- var _c;
1459
- return __generator(this, function (_d) {
1460
- switch (_d.label) {
1461
- case 0:
1462
- _a = [__assign({}, output)];
1463
- _c = {};
1464
- return [4, parseErrorBody(output.body, context)];
1465
- case 1:
1466
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1467
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1468
- _b = errorCode;
1469
- switch (_b) {
1470
- case "ConcurrentModificationException": return [3, 2];
1471
- case "com.amazonaws.cognitosync#ConcurrentModificationException": return [3, 2];
1472
- case "InternalErrorException": return [3, 4];
1473
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 4];
1474
- case "InvalidParameterException": return [3, 6];
1475
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 6];
1476
- case "NotAuthorizedException": return [3, 8];
1477
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 8];
1478
- case "ResourceNotFoundException": return [3, 10];
1479
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 10];
1480
- case "TooManyRequestsException": return [3, 12];
1481
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 12];
1482
- }
1483
- return [3, 14];
1484
- case 2: return [4, deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context)];
1485
- case 3: throw _d.sent();
1486
- case 4: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1487
- case 5: throw _d.sent();
1488
- case 6: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1489
- case 7: throw _d.sent();
1490
- case 8: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1491
- case 9: throw _d.sent();
1492
- case 10: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1493
- case 11: throw _d.sent();
1494
- case 12: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1495
- case 13: throw _d.sent();
1496
- case 14:
1497
- parsedBody = parsedOutput.body;
1498
- throwDefaultError({
1499
- output: output,
1500
- parsedBody: parsedBody,
1501
- exceptionCtor: __BaseException,
1502
- errorCode: errorCode,
1503
- });
1504
- _d.label = 15;
1505
- case 15: return [2];
1506
- }
788
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
789
+ if (data.Count != null) {
790
+ contents.Count = __expectInt32(data.Count);
791
+ }
792
+ if (data.IdentityPoolUsages != null) {
793
+ contents.IdentityPoolUsages = deserializeAws_restJson1IdentityPoolUsageList(data.IdentityPoolUsages, context);
794
+ }
795
+ if (data.MaxResults != null) {
796
+ contents.MaxResults = __expectInt32(data.MaxResults);
797
+ }
798
+ if (data.NextToken != null) {
799
+ contents.NextToken = __expectString(data.NextToken);
800
+ }
801
+ return contents;
802
+ };
803
+ const deserializeAws_restJson1ListIdentityPoolUsageCommandError = async (output, context) => {
804
+ const parsedOutput = {
805
+ ...output,
806
+ body: await parseErrorBody(output.body, context),
807
+ };
808
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
809
+ switch (errorCode) {
810
+ case "InternalErrorException":
811
+ case "com.amazonaws.cognitosync#InternalErrorException":
812
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
813
+ case "InvalidParameterException":
814
+ case "com.amazonaws.cognitosync#InvalidParameterException":
815
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
816
+ case "NotAuthorizedException":
817
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
818
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
819
+ case "TooManyRequestsException":
820
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
821
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
822
+ default:
823
+ const parsedBody = parsedOutput.body;
824
+ throwDefaultError({
825
+ output,
826
+ parsedBody,
827
+ exceptionCtor: __BaseException,
828
+ errorCode,
829
+ });
830
+ }
831
+ };
832
+ export const deserializeAws_restJson1ListRecordsCommand = async (output, context) => {
833
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
834
+ return deserializeAws_restJson1ListRecordsCommandError(output, context);
835
+ }
836
+ const contents = map({
837
+ $metadata: deserializeMetadata(output),
1507
838
  });
1508
- }); };
1509
- export var deserializeAws_restJson1SubscribeToDatasetCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1510
- var contents;
1511
- return __generator(this, function (_a) {
1512
- switch (_a.label) {
1513
- case 0:
1514
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1515
- return [2, deserializeAws_restJson1SubscribeToDatasetCommandError(output, context)];
1516
- }
1517
- contents = map({
1518
- $metadata: deserializeMetadata(output),
1519
- });
1520
- return [4, collectBody(output.body, context)];
1521
- case 1:
1522
- _a.sent();
1523
- return [2, contents];
1524
- }
839
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
840
+ if (data.Count != null) {
841
+ contents.Count = __expectInt32(data.Count);
842
+ }
843
+ if (data.DatasetDeletedAfterRequestedSyncCount != null) {
844
+ contents.DatasetDeletedAfterRequestedSyncCount = __expectBoolean(data.DatasetDeletedAfterRequestedSyncCount);
845
+ }
846
+ if (data.DatasetExists != null) {
847
+ contents.DatasetExists = __expectBoolean(data.DatasetExists);
848
+ }
849
+ if (data.DatasetSyncCount != null) {
850
+ contents.DatasetSyncCount = __expectLong(data.DatasetSyncCount);
851
+ }
852
+ if (data.LastModifiedBy != null) {
853
+ contents.LastModifiedBy = __expectString(data.LastModifiedBy);
854
+ }
855
+ if (data.MergedDatasetNames != null) {
856
+ contents.MergedDatasetNames = deserializeAws_restJson1MergedDatasetNameList(data.MergedDatasetNames, context);
857
+ }
858
+ if (data.NextToken != null) {
859
+ contents.NextToken = __expectString(data.NextToken);
860
+ }
861
+ if (data.Records != null) {
862
+ contents.Records = deserializeAws_restJson1RecordList(data.Records, context);
863
+ }
864
+ if (data.SyncSessionToken != null) {
865
+ contents.SyncSessionToken = __expectString(data.SyncSessionToken);
866
+ }
867
+ return contents;
868
+ };
869
+ const deserializeAws_restJson1ListRecordsCommandError = async (output, context) => {
870
+ const parsedOutput = {
871
+ ...output,
872
+ body: await parseErrorBody(output.body, context),
873
+ };
874
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
875
+ switch (errorCode) {
876
+ case "InternalErrorException":
877
+ case "com.amazonaws.cognitosync#InternalErrorException":
878
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
879
+ case "InvalidParameterException":
880
+ case "com.amazonaws.cognitosync#InvalidParameterException":
881
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
882
+ case "NotAuthorizedException":
883
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
884
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
885
+ case "TooManyRequestsException":
886
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
887
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
888
+ default:
889
+ const parsedBody = parsedOutput.body;
890
+ throwDefaultError({
891
+ output,
892
+ parsedBody,
893
+ exceptionCtor: __BaseException,
894
+ errorCode,
895
+ });
896
+ }
897
+ };
898
+ export const deserializeAws_restJson1RegisterDeviceCommand = async (output, context) => {
899
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
900
+ return deserializeAws_restJson1RegisterDeviceCommandError(output, context);
901
+ }
902
+ const contents = map({
903
+ $metadata: deserializeMetadata(output),
1525
904
  });
1526
- }); };
1527
- var deserializeAws_restJson1SubscribeToDatasetCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1528
- var parsedOutput, _a, errorCode, _b, parsedBody;
1529
- var _c;
1530
- return __generator(this, function (_d) {
1531
- switch (_d.label) {
1532
- case 0:
1533
- _a = [__assign({}, output)];
1534
- _c = {};
1535
- return [4, parseErrorBody(output.body, context)];
1536
- case 1:
1537
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1538
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1539
- _b = errorCode;
1540
- switch (_b) {
1541
- case "InternalErrorException": return [3, 2];
1542
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
1543
- case "InvalidConfigurationException": return [3, 4];
1544
- case "com.amazonaws.cognitosync#InvalidConfigurationException": return [3, 4];
1545
- case "InvalidParameterException": return [3, 6];
1546
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 6];
1547
- case "NotAuthorizedException": return [3, 8];
1548
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 8];
1549
- case "ResourceNotFoundException": return [3, 10];
1550
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 10];
1551
- case "TooManyRequestsException": return [3, 12];
1552
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 12];
1553
- }
1554
- return [3, 14];
1555
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1556
- case 3: throw _d.sent();
1557
- case 4: return [4, deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context)];
1558
- case 5: throw _d.sent();
1559
- case 6: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1560
- case 7: throw _d.sent();
1561
- case 8: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1562
- case 9: throw _d.sent();
1563
- case 10: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1564
- case 11: throw _d.sent();
1565
- case 12: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1566
- case 13: throw _d.sent();
1567
- case 14:
1568
- parsedBody = parsedOutput.body;
1569
- throwDefaultError({
1570
- output: output,
1571
- parsedBody: parsedBody,
1572
- exceptionCtor: __BaseException,
1573
- errorCode: errorCode,
1574
- });
1575
- _d.label = 15;
1576
- case 15: return [2];
1577
- }
905
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
906
+ if (data.DeviceId != null) {
907
+ contents.DeviceId = __expectString(data.DeviceId);
908
+ }
909
+ return contents;
910
+ };
911
+ const deserializeAws_restJson1RegisterDeviceCommandError = async (output, context) => {
912
+ const parsedOutput = {
913
+ ...output,
914
+ body: await parseErrorBody(output.body, context),
915
+ };
916
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
917
+ switch (errorCode) {
918
+ case "InternalErrorException":
919
+ case "com.amazonaws.cognitosync#InternalErrorException":
920
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
921
+ case "InvalidConfigurationException":
922
+ case "com.amazonaws.cognitosync#InvalidConfigurationException":
923
+ throw await deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context);
924
+ case "InvalidParameterException":
925
+ case "com.amazonaws.cognitosync#InvalidParameterException":
926
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
927
+ case "NotAuthorizedException":
928
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
929
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
930
+ case "ResourceNotFoundException":
931
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
932
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
933
+ case "TooManyRequestsException":
934
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
935
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
936
+ default:
937
+ const parsedBody = parsedOutput.body;
938
+ throwDefaultError({
939
+ output,
940
+ parsedBody,
941
+ exceptionCtor: __BaseException,
942
+ errorCode,
943
+ });
944
+ }
945
+ };
946
+ export const deserializeAws_restJson1SetCognitoEventsCommand = async (output, context) => {
947
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
948
+ return deserializeAws_restJson1SetCognitoEventsCommandError(output, context);
949
+ }
950
+ const contents = map({
951
+ $metadata: deserializeMetadata(output),
1578
952
  });
1579
- }); };
1580
- export var deserializeAws_restJson1UnsubscribeFromDatasetCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1581
- var contents;
1582
- return __generator(this, function (_a) {
1583
- switch (_a.label) {
1584
- case 0:
1585
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1586
- return [2, deserializeAws_restJson1UnsubscribeFromDatasetCommandError(output, context)];
1587
- }
1588
- contents = map({
1589
- $metadata: deserializeMetadata(output),
1590
- });
1591
- return [4, collectBody(output.body, context)];
1592
- case 1:
1593
- _a.sent();
1594
- return [2, contents];
1595
- }
953
+ await collectBody(output.body, context);
954
+ return contents;
955
+ };
956
+ const deserializeAws_restJson1SetCognitoEventsCommandError = async (output, context) => {
957
+ const parsedOutput = {
958
+ ...output,
959
+ body: await parseErrorBody(output.body, context),
960
+ };
961
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
962
+ switch (errorCode) {
963
+ case "InternalErrorException":
964
+ case "com.amazonaws.cognitosync#InternalErrorException":
965
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
966
+ case "InvalidParameterException":
967
+ case "com.amazonaws.cognitosync#InvalidParameterException":
968
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
969
+ case "NotAuthorizedException":
970
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
971
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
972
+ case "ResourceNotFoundException":
973
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
974
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
975
+ case "TooManyRequestsException":
976
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
977
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
978
+ default:
979
+ const parsedBody = parsedOutput.body;
980
+ throwDefaultError({
981
+ output,
982
+ parsedBody,
983
+ exceptionCtor: __BaseException,
984
+ errorCode,
985
+ });
986
+ }
987
+ };
988
+ export const deserializeAws_restJson1SetIdentityPoolConfigurationCommand = async (output, context) => {
989
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
990
+ return deserializeAws_restJson1SetIdentityPoolConfigurationCommandError(output, context);
991
+ }
992
+ const contents = map({
993
+ $metadata: deserializeMetadata(output),
1596
994
  });
1597
- }); };
1598
- var deserializeAws_restJson1UnsubscribeFromDatasetCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1599
- var parsedOutput, _a, errorCode, _b, parsedBody;
1600
- var _c;
1601
- return __generator(this, function (_d) {
1602
- switch (_d.label) {
1603
- case 0:
1604
- _a = [__assign({}, output)];
1605
- _c = {};
1606
- return [4, parseErrorBody(output.body, context)];
1607
- case 1:
1608
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1609
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1610
- _b = errorCode;
1611
- switch (_b) {
1612
- case "InternalErrorException": return [3, 2];
1613
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
1614
- case "InvalidConfigurationException": return [3, 4];
1615
- case "com.amazonaws.cognitosync#InvalidConfigurationException": return [3, 4];
1616
- case "InvalidParameterException": return [3, 6];
1617
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 6];
1618
- case "NotAuthorizedException": return [3, 8];
1619
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 8];
1620
- case "ResourceNotFoundException": return [3, 10];
1621
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 10];
1622
- case "TooManyRequestsException": return [3, 12];
1623
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 12];
1624
- }
1625
- return [3, 14];
1626
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1627
- case 3: throw _d.sent();
1628
- case 4: return [4, deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context)];
1629
- case 5: throw _d.sent();
1630
- case 6: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1631
- case 7: throw _d.sent();
1632
- case 8: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1633
- case 9: throw _d.sent();
1634
- case 10: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1635
- case 11: throw _d.sent();
1636
- case 12: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1637
- case 13: throw _d.sent();
1638
- case 14:
1639
- parsedBody = parsedOutput.body;
1640
- throwDefaultError({
1641
- output: output,
1642
- parsedBody: parsedBody,
1643
- exceptionCtor: __BaseException,
1644
- errorCode: errorCode,
1645
- });
1646
- _d.label = 15;
1647
- case 15: return [2];
1648
- }
995
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
996
+ if (data.CognitoStreams != null) {
997
+ contents.CognitoStreams = deserializeAws_restJson1CognitoStreams(data.CognitoStreams, context);
998
+ }
999
+ if (data.IdentityPoolId != null) {
1000
+ contents.IdentityPoolId = __expectString(data.IdentityPoolId);
1001
+ }
1002
+ if (data.PushSync != null) {
1003
+ contents.PushSync = deserializeAws_restJson1PushSync(data.PushSync, context);
1004
+ }
1005
+ return contents;
1006
+ };
1007
+ const deserializeAws_restJson1SetIdentityPoolConfigurationCommandError = async (output, context) => {
1008
+ const parsedOutput = {
1009
+ ...output,
1010
+ body: await parseErrorBody(output.body, context),
1011
+ };
1012
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1013
+ switch (errorCode) {
1014
+ case "ConcurrentModificationException":
1015
+ case "com.amazonaws.cognitosync#ConcurrentModificationException":
1016
+ throw await deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context);
1017
+ case "InternalErrorException":
1018
+ case "com.amazonaws.cognitosync#InternalErrorException":
1019
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1020
+ case "InvalidParameterException":
1021
+ case "com.amazonaws.cognitosync#InvalidParameterException":
1022
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1023
+ case "NotAuthorizedException":
1024
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
1025
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1026
+ case "ResourceNotFoundException":
1027
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
1028
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1029
+ case "TooManyRequestsException":
1030
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
1031
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1032
+ default:
1033
+ const parsedBody = parsedOutput.body;
1034
+ throwDefaultError({
1035
+ output,
1036
+ parsedBody,
1037
+ exceptionCtor: __BaseException,
1038
+ errorCode,
1039
+ });
1040
+ }
1041
+ };
1042
+ export const deserializeAws_restJson1SubscribeToDatasetCommand = async (output, context) => {
1043
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1044
+ return deserializeAws_restJson1SubscribeToDatasetCommandError(output, context);
1045
+ }
1046
+ const contents = map({
1047
+ $metadata: deserializeMetadata(output),
1649
1048
  });
1650
- }); };
1651
- export var deserializeAws_restJson1UpdateRecordsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1652
- var contents, data, _a, _b;
1653
- return __generator(this, function (_c) {
1654
- switch (_c.label) {
1655
- case 0:
1656
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1657
- return [2, deserializeAws_restJson1UpdateRecordsCommandError(output, context)];
1658
- }
1659
- contents = map({
1660
- $metadata: deserializeMetadata(output),
1661
- });
1662
- _a = __expectNonNull;
1663
- _b = __expectObject;
1664
- return [4, parseBody(output.body, context)];
1665
- case 1:
1666
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1667
- if (data.Records != null) {
1668
- contents.Records = deserializeAws_restJson1RecordList(data.Records, context);
1669
- }
1670
- return [2, contents];
1671
- }
1049
+ await collectBody(output.body, context);
1050
+ return contents;
1051
+ };
1052
+ const deserializeAws_restJson1SubscribeToDatasetCommandError = async (output, context) => {
1053
+ const parsedOutput = {
1054
+ ...output,
1055
+ body: await parseErrorBody(output.body, context),
1056
+ };
1057
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1058
+ switch (errorCode) {
1059
+ case "InternalErrorException":
1060
+ case "com.amazonaws.cognitosync#InternalErrorException":
1061
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1062
+ case "InvalidConfigurationException":
1063
+ case "com.amazonaws.cognitosync#InvalidConfigurationException":
1064
+ throw await deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context);
1065
+ case "InvalidParameterException":
1066
+ case "com.amazonaws.cognitosync#InvalidParameterException":
1067
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1068
+ case "NotAuthorizedException":
1069
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
1070
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1071
+ case "ResourceNotFoundException":
1072
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
1073
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1074
+ case "TooManyRequestsException":
1075
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
1076
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1077
+ default:
1078
+ const parsedBody = parsedOutput.body;
1079
+ throwDefaultError({
1080
+ output,
1081
+ parsedBody,
1082
+ exceptionCtor: __BaseException,
1083
+ errorCode,
1084
+ });
1085
+ }
1086
+ };
1087
+ export const deserializeAws_restJson1UnsubscribeFromDatasetCommand = async (output, context) => {
1088
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1089
+ return deserializeAws_restJson1UnsubscribeFromDatasetCommandError(output, context);
1090
+ }
1091
+ const contents = map({
1092
+ $metadata: deserializeMetadata(output),
1672
1093
  });
1673
- }); };
1674
- var deserializeAws_restJson1UpdateRecordsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1675
- var parsedOutput, _a, errorCode, _b, parsedBody;
1676
- var _c;
1677
- return __generator(this, function (_d) {
1678
- switch (_d.label) {
1679
- case 0:
1680
- _a = [__assign({}, output)];
1681
- _c = {};
1682
- return [4, parseErrorBody(output.body, context)];
1683
- case 1:
1684
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1685
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1686
- _b = errorCode;
1687
- switch (_b) {
1688
- case "InternalErrorException": return [3, 2];
1689
- case "com.amazonaws.cognitosync#InternalErrorException": return [3, 2];
1690
- case "InvalidLambdaFunctionOutputException": return [3, 4];
1691
- case "com.amazonaws.cognitosync#InvalidLambdaFunctionOutputException": return [3, 4];
1692
- case "InvalidParameterException": return [3, 6];
1693
- case "com.amazonaws.cognitosync#InvalidParameterException": return [3, 6];
1694
- case "LambdaThrottledException": return [3, 8];
1695
- case "com.amazonaws.cognitosync#LambdaThrottledException": return [3, 8];
1696
- case "LimitExceededException": return [3, 10];
1697
- case "com.amazonaws.cognitosync#LimitExceededException": return [3, 10];
1698
- case "NotAuthorizedException": return [3, 12];
1699
- case "com.amazonaws.cognitosync#NotAuthorizedException": return [3, 12];
1700
- case "ResourceConflictException": return [3, 14];
1701
- case "com.amazonaws.cognitosync#ResourceConflictException": return [3, 14];
1702
- case "ResourceNotFoundException": return [3, 16];
1703
- case "com.amazonaws.cognitosync#ResourceNotFoundException": return [3, 16];
1704
- case "TooManyRequestsException": return [3, 18];
1705
- case "com.amazonaws.cognitosync#TooManyRequestsException": return [3, 18];
1706
- }
1707
- return [3, 20];
1708
- case 2: return [4, deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)];
1709
- case 3: throw _d.sent();
1710
- case 4: return [4, deserializeAws_restJson1InvalidLambdaFunctionOutputExceptionResponse(parsedOutput, context)];
1711
- case 5: throw _d.sent();
1712
- case 6: return [4, deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)];
1713
- case 7: throw _d.sent();
1714
- case 8: return [4, deserializeAws_restJson1LambdaThrottledExceptionResponse(parsedOutput, context)];
1715
- case 9: throw _d.sent();
1716
- case 10: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
1717
- case 11: throw _d.sent();
1718
- case 12: return [4, deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)];
1719
- case 13: throw _d.sent();
1720
- case 14: return [4, deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context)];
1721
- case 15: throw _d.sent();
1722
- case 16: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1723
- case 17: throw _d.sent();
1724
- case 18: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
1725
- case 19: throw _d.sent();
1726
- case 20:
1727
- parsedBody = parsedOutput.body;
1728
- throwDefaultError({
1729
- output: output,
1730
- parsedBody: parsedBody,
1731
- exceptionCtor: __BaseException,
1732
- errorCode: errorCode,
1733
- });
1734
- _d.label = 21;
1735
- case 21: return [2];
1736
- }
1094
+ await collectBody(output.body, context);
1095
+ return contents;
1096
+ };
1097
+ const deserializeAws_restJson1UnsubscribeFromDatasetCommandError = async (output, context) => {
1098
+ const parsedOutput = {
1099
+ ...output,
1100
+ body: await parseErrorBody(output.body, context),
1101
+ };
1102
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1103
+ switch (errorCode) {
1104
+ case "InternalErrorException":
1105
+ case "com.amazonaws.cognitosync#InternalErrorException":
1106
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1107
+ case "InvalidConfigurationException":
1108
+ case "com.amazonaws.cognitosync#InvalidConfigurationException":
1109
+ throw await deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context);
1110
+ case "InvalidParameterException":
1111
+ case "com.amazonaws.cognitosync#InvalidParameterException":
1112
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1113
+ case "NotAuthorizedException":
1114
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
1115
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1116
+ case "ResourceNotFoundException":
1117
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
1118
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1119
+ case "TooManyRequestsException":
1120
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
1121
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1122
+ default:
1123
+ const parsedBody = parsedOutput.body;
1124
+ throwDefaultError({
1125
+ output,
1126
+ parsedBody,
1127
+ exceptionCtor: __BaseException,
1128
+ errorCode,
1129
+ });
1130
+ }
1131
+ };
1132
+ export const deserializeAws_restJson1UpdateRecordsCommand = async (output, context) => {
1133
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1134
+ return deserializeAws_restJson1UpdateRecordsCommandError(output, context);
1135
+ }
1136
+ const contents = map({
1137
+ $metadata: deserializeMetadata(output),
1737
1138
  });
1738
- }); };
1739
- var map = __map;
1740
- var deserializeAws_restJson1AlreadyStreamedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1741
- var contents, data, exception;
1742
- return __generator(this, function (_a) {
1743
- contents = map({});
1744
- data = parsedOutput.body;
1745
- if (data.message != null) {
1746
- contents.message = __expectString(data.message);
1747
- }
1748
- exception = new AlreadyStreamedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1749
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1139
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1140
+ if (data.Records != null) {
1141
+ contents.Records = deserializeAws_restJson1RecordList(data.Records, context);
1142
+ }
1143
+ return contents;
1144
+ };
1145
+ const deserializeAws_restJson1UpdateRecordsCommandError = async (output, context) => {
1146
+ const parsedOutput = {
1147
+ ...output,
1148
+ body: await parseErrorBody(output.body, context),
1149
+ };
1150
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1151
+ switch (errorCode) {
1152
+ case "InternalErrorException":
1153
+ case "com.amazonaws.cognitosync#InternalErrorException":
1154
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1155
+ case "InvalidLambdaFunctionOutputException":
1156
+ case "com.amazonaws.cognitosync#InvalidLambdaFunctionOutputException":
1157
+ throw await deserializeAws_restJson1InvalidLambdaFunctionOutputExceptionResponse(parsedOutput, context);
1158
+ case "InvalidParameterException":
1159
+ case "com.amazonaws.cognitosync#InvalidParameterException":
1160
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1161
+ case "LambdaThrottledException":
1162
+ case "com.amazonaws.cognitosync#LambdaThrottledException":
1163
+ throw await deserializeAws_restJson1LambdaThrottledExceptionResponse(parsedOutput, context);
1164
+ case "LimitExceededException":
1165
+ case "com.amazonaws.cognitosync#LimitExceededException":
1166
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
1167
+ case "NotAuthorizedException":
1168
+ case "com.amazonaws.cognitosync#NotAuthorizedException":
1169
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1170
+ case "ResourceConflictException":
1171
+ case "com.amazonaws.cognitosync#ResourceConflictException":
1172
+ throw await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context);
1173
+ case "ResourceNotFoundException":
1174
+ case "com.amazonaws.cognitosync#ResourceNotFoundException":
1175
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1176
+ case "TooManyRequestsException":
1177
+ case "com.amazonaws.cognitosync#TooManyRequestsException":
1178
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1179
+ default:
1180
+ const parsedBody = parsedOutput.body;
1181
+ throwDefaultError({
1182
+ output,
1183
+ parsedBody,
1184
+ exceptionCtor: __BaseException,
1185
+ errorCode,
1186
+ });
1187
+ }
1188
+ };
1189
+ const map = __map;
1190
+ const deserializeAws_restJson1AlreadyStreamedExceptionResponse = async (parsedOutput, context) => {
1191
+ const contents = map({});
1192
+ const data = parsedOutput.body;
1193
+ if (data.message != null) {
1194
+ contents.message = __expectString(data.message);
1195
+ }
1196
+ const exception = new AlreadyStreamedException({
1197
+ $metadata: deserializeMetadata(parsedOutput),
1198
+ ...contents,
1750
1199
  });
1751
- }); };
1752
- var deserializeAws_restJson1ConcurrentModificationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1753
- var contents, data, exception;
1754
- return __generator(this, function (_a) {
1755
- contents = map({});
1756
- data = parsedOutput.body;
1757
- if (data.message != null) {
1758
- contents.message = __expectString(data.message);
1759
- }
1760
- exception = new ConcurrentModificationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1761
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1200
+ return __decorateServiceException(exception, parsedOutput.body);
1201
+ };
1202
+ const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
1203
+ const contents = map({});
1204
+ const data = parsedOutput.body;
1205
+ if (data.message != null) {
1206
+ contents.message = __expectString(data.message);
1207
+ }
1208
+ const exception = new ConcurrentModificationException({
1209
+ $metadata: deserializeMetadata(parsedOutput),
1210
+ ...contents,
1762
1211
  });
1763
- }); };
1764
- var deserializeAws_restJson1DuplicateRequestExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1765
- var contents, data, exception;
1766
- return __generator(this, function (_a) {
1767
- contents = map({});
1768
- data = parsedOutput.body;
1769
- if (data.message != null) {
1770
- contents.message = __expectString(data.message);
1771
- }
1772
- exception = new DuplicateRequestException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1773
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1212
+ return __decorateServiceException(exception, parsedOutput.body);
1213
+ };
1214
+ const deserializeAws_restJson1DuplicateRequestExceptionResponse = async (parsedOutput, context) => {
1215
+ const contents = map({});
1216
+ const data = parsedOutput.body;
1217
+ if (data.message != null) {
1218
+ contents.message = __expectString(data.message);
1219
+ }
1220
+ const exception = new DuplicateRequestException({
1221
+ $metadata: deserializeMetadata(parsedOutput),
1222
+ ...contents,
1774
1223
  });
1775
- }); };
1776
- var deserializeAws_restJson1InternalErrorExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1777
- var contents, data, exception;
1778
- return __generator(this, function (_a) {
1779
- contents = map({});
1780
- data = parsedOutput.body;
1781
- if (data.message != null) {
1782
- contents.message = __expectString(data.message);
1783
- }
1784
- exception = new InternalErrorException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1785
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1224
+ return __decorateServiceException(exception, parsedOutput.body);
1225
+ };
1226
+ const deserializeAws_restJson1InternalErrorExceptionResponse = async (parsedOutput, context) => {
1227
+ const contents = map({});
1228
+ const data = parsedOutput.body;
1229
+ if (data.message != null) {
1230
+ contents.message = __expectString(data.message);
1231
+ }
1232
+ const exception = new InternalErrorException({
1233
+ $metadata: deserializeMetadata(parsedOutput),
1234
+ ...contents,
1786
1235
  });
1787
- }); };
1788
- var deserializeAws_restJson1InvalidConfigurationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1789
- var contents, data, exception;
1790
- return __generator(this, function (_a) {
1791
- contents = map({});
1792
- data = parsedOutput.body;
1793
- if (data.message != null) {
1794
- contents.message = __expectString(data.message);
1795
- }
1796
- exception = new InvalidConfigurationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1797
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1236
+ return __decorateServiceException(exception, parsedOutput.body);
1237
+ };
1238
+ const deserializeAws_restJson1InvalidConfigurationExceptionResponse = async (parsedOutput, context) => {
1239
+ const contents = map({});
1240
+ const data = parsedOutput.body;
1241
+ if (data.message != null) {
1242
+ contents.message = __expectString(data.message);
1243
+ }
1244
+ const exception = new InvalidConfigurationException({
1245
+ $metadata: deserializeMetadata(parsedOutput),
1246
+ ...contents,
1798
1247
  });
1799
- }); };
1800
- var deserializeAws_restJson1InvalidLambdaFunctionOutputExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1801
- var contents, data, exception;
1802
- return __generator(this, function (_a) {
1803
- contents = map({});
1804
- data = parsedOutput.body;
1805
- if (data.message != null) {
1806
- contents.message = __expectString(data.message);
1807
- }
1808
- exception = new InvalidLambdaFunctionOutputException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1809
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1248
+ return __decorateServiceException(exception, parsedOutput.body);
1249
+ };
1250
+ const deserializeAws_restJson1InvalidLambdaFunctionOutputExceptionResponse = async (parsedOutput, context) => {
1251
+ const contents = map({});
1252
+ const data = parsedOutput.body;
1253
+ if (data.message != null) {
1254
+ contents.message = __expectString(data.message);
1255
+ }
1256
+ const exception = new InvalidLambdaFunctionOutputException({
1257
+ $metadata: deserializeMetadata(parsedOutput),
1258
+ ...contents,
1810
1259
  });
1811
- }); };
1812
- var deserializeAws_restJson1InvalidParameterExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1813
- var contents, data, exception;
1814
- return __generator(this, function (_a) {
1815
- contents = map({});
1816
- data = parsedOutput.body;
1817
- if (data.message != null) {
1818
- contents.message = __expectString(data.message);
1819
- }
1820
- exception = new InvalidParameterException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1821
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1260
+ return __decorateServiceException(exception, parsedOutput.body);
1261
+ };
1262
+ const deserializeAws_restJson1InvalidParameterExceptionResponse = async (parsedOutput, context) => {
1263
+ const contents = map({});
1264
+ const data = parsedOutput.body;
1265
+ if (data.message != null) {
1266
+ contents.message = __expectString(data.message);
1267
+ }
1268
+ const exception = new InvalidParameterException({
1269
+ $metadata: deserializeMetadata(parsedOutput),
1270
+ ...contents,
1822
1271
  });
1823
- }); };
1824
- var deserializeAws_restJson1LambdaThrottledExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1825
- var contents, data, exception;
1826
- return __generator(this, function (_a) {
1827
- contents = map({});
1828
- data = parsedOutput.body;
1829
- if (data.message != null) {
1830
- contents.message = __expectString(data.message);
1831
- }
1832
- exception = new LambdaThrottledException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1833
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1272
+ return __decorateServiceException(exception, parsedOutput.body);
1273
+ };
1274
+ const deserializeAws_restJson1LambdaThrottledExceptionResponse = async (parsedOutput, context) => {
1275
+ const contents = map({});
1276
+ const data = parsedOutput.body;
1277
+ if (data.message != null) {
1278
+ contents.message = __expectString(data.message);
1279
+ }
1280
+ const exception = new LambdaThrottledException({
1281
+ $metadata: deserializeMetadata(parsedOutput),
1282
+ ...contents,
1834
1283
  });
1835
- }); };
1836
- var deserializeAws_restJson1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1837
- var contents, data, exception;
1838
- return __generator(this, function (_a) {
1839
- contents = map({});
1840
- data = parsedOutput.body;
1841
- if (data.message != null) {
1842
- contents.message = __expectString(data.message);
1843
- }
1844
- exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1845
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1284
+ return __decorateServiceException(exception, parsedOutput.body);
1285
+ };
1286
+ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
1287
+ const contents = map({});
1288
+ const data = parsedOutput.body;
1289
+ if (data.message != null) {
1290
+ contents.message = __expectString(data.message);
1291
+ }
1292
+ const exception = new LimitExceededException({
1293
+ $metadata: deserializeMetadata(parsedOutput),
1294
+ ...contents,
1846
1295
  });
1847
- }); };
1848
- var deserializeAws_restJson1NotAuthorizedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1849
- var contents, data, exception;
1850
- return __generator(this, function (_a) {
1851
- contents = map({});
1852
- data = parsedOutput.body;
1853
- if (data.message != null) {
1854
- contents.message = __expectString(data.message);
1855
- }
1856
- exception = new NotAuthorizedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1857
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1296
+ return __decorateServiceException(exception, parsedOutput.body);
1297
+ };
1298
+ const deserializeAws_restJson1NotAuthorizedExceptionResponse = async (parsedOutput, context) => {
1299
+ const contents = map({});
1300
+ const data = parsedOutput.body;
1301
+ if (data.message != null) {
1302
+ contents.message = __expectString(data.message);
1303
+ }
1304
+ const exception = new NotAuthorizedException({
1305
+ $metadata: deserializeMetadata(parsedOutput),
1306
+ ...contents,
1858
1307
  });
1859
- }); };
1860
- var deserializeAws_restJson1ResourceConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1861
- var contents, data, exception;
1862
- return __generator(this, function (_a) {
1863
- contents = map({});
1864
- data = parsedOutput.body;
1865
- if (data.message != null) {
1866
- contents.message = __expectString(data.message);
1867
- }
1868
- exception = new ResourceConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1869
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1308
+ return __decorateServiceException(exception, parsedOutput.body);
1309
+ };
1310
+ const deserializeAws_restJson1ResourceConflictExceptionResponse = async (parsedOutput, context) => {
1311
+ const contents = map({});
1312
+ const data = parsedOutput.body;
1313
+ if (data.message != null) {
1314
+ contents.message = __expectString(data.message);
1315
+ }
1316
+ const exception = new ResourceConflictException({
1317
+ $metadata: deserializeMetadata(parsedOutput),
1318
+ ...contents,
1870
1319
  });
1871
- }); };
1872
- var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1873
- var contents, data, exception;
1874
- return __generator(this, function (_a) {
1875
- contents = map({});
1876
- data = parsedOutput.body;
1877
- if (data.message != null) {
1878
- contents.message = __expectString(data.message);
1879
- }
1880
- exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1881
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1320
+ return __decorateServiceException(exception, parsedOutput.body);
1321
+ };
1322
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1323
+ const contents = map({});
1324
+ const data = parsedOutput.body;
1325
+ if (data.message != null) {
1326
+ contents.message = __expectString(data.message);
1327
+ }
1328
+ const exception = new ResourceNotFoundException({
1329
+ $metadata: deserializeMetadata(parsedOutput),
1330
+ ...contents,
1882
1331
  });
1883
- }); };
1884
- var deserializeAws_restJson1TooManyRequestsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1885
- var contents, data, exception;
1886
- return __generator(this, function (_a) {
1887
- contents = map({});
1888
- data = parsedOutput.body;
1889
- if (data.message != null) {
1890
- contents.message = __expectString(data.message);
1891
- }
1892
- exception = new TooManyRequestsException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1893
- return [2, __decorateServiceException(exception, parsedOutput.body)];
1332
+ return __decorateServiceException(exception, parsedOutput.body);
1333
+ };
1334
+ const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
1335
+ const contents = map({});
1336
+ const data = parsedOutput.body;
1337
+ if (data.message != null) {
1338
+ contents.message = __expectString(data.message);
1339
+ }
1340
+ const exception = new TooManyRequestsException({
1341
+ $metadata: deserializeMetadata(parsedOutput),
1342
+ ...contents,
1894
1343
  });
1895
- }); };
1896
- var serializeAws_restJson1ApplicationArnList = function (input, context) {
1344
+ return __decorateServiceException(exception, parsedOutput.body);
1345
+ };
1346
+ const serializeAws_restJson1ApplicationArnList = (input, context) => {
1897
1347
  return input
1898
- .filter(function (e) { return e != null; })
1899
- .map(function (entry) {
1348
+ .filter((e) => e != null)
1349
+ .map((entry) => {
1900
1350
  return entry;
1901
1351
  });
1902
1352
  };
1903
- var serializeAws_restJson1CognitoStreams = function (input, context) {
1904
- return __assign(__assign(__assign({}, (input.RoleArn != null && { RoleArn: input.RoleArn })), (input.StreamName != null && { StreamName: input.StreamName })), (input.StreamingStatus != null && { StreamingStatus: input.StreamingStatus }));
1353
+ const serializeAws_restJson1CognitoStreams = (input, context) => {
1354
+ return {
1355
+ ...(input.RoleArn != null && { RoleArn: input.RoleArn }),
1356
+ ...(input.StreamName != null && { StreamName: input.StreamName }),
1357
+ ...(input.StreamingStatus != null && { StreamingStatus: input.StreamingStatus }),
1358
+ };
1905
1359
  };
1906
- var serializeAws_restJson1Events = function (input, context) {
1907
- return Object.entries(input).reduce(function (acc, _a) {
1908
- var _b;
1909
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1360
+ const serializeAws_restJson1Events = (input, context) => {
1361
+ return Object.entries(input).reduce((acc, [key, value]) => {
1910
1362
  if (value === null) {
1911
1363
  return acc;
1912
1364
  }
1913
- return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
1365
+ return {
1366
+ ...acc,
1367
+ [key]: value,
1368
+ };
1914
1369
  }, {});
1915
1370
  };
1916
- var serializeAws_restJson1PushSync = function (input, context) {
1917
- return __assign(__assign({}, (input.ApplicationArns != null && {
1918
- ApplicationArns: serializeAws_restJson1ApplicationArnList(input.ApplicationArns, context),
1919
- })), (input.RoleArn != null && { RoleArn: input.RoleArn }));
1371
+ const serializeAws_restJson1PushSync = (input, context) => {
1372
+ return {
1373
+ ...(input.ApplicationArns != null && {
1374
+ ApplicationArns: serializeAws_restJson1ApplicationArnList(input.ApplicationArns, context),
1375
+ }),
1376
+ ...(input.RoleArn != null && { RoleArn: input.RoleArn }),
1377
+ };
1920
1378
  };
1921
- var serializeAws_restJson1RecordPatch = function (input, context) {
1922
- return __assign(__assign(__assign(__assign(__assign({}, (input.DeviceLastModifiedDate != null && {
1923
- DeviceLastModifiedDate: Math.round(input.DeviceLastModifiedDate.getTime() / 1000),
1924
- })), (input.Key != null && { Key: input.Key })), (input.Op != null && { Op: input.Op })), (input.SyncCount != null && { SyncCount: input.SyncCount })), (input.Value != null && { Value: input.Value }));
1379
+ const serializeAws_restJson1RecordPatch = (input, context) => {
1380
+ return {
1381
+ ...(input.DeviceLastModifiedDate != null && {
1382
+ DeviceLastModifiedDate: Math.round(input.DeviceLastModifiedDate.getTime() / 1000),
1383
+ }),
1384
+ ...(input.Key != null && { Key: input.Key }),
1385
+ ...(input.Op != null && { Op: input.Op }),
1386
+ ...(input.SyncCount != null && { SyncCount: input.SyncCount }),
1387
+ ...(input.Value != null && { Value: input.Value }),
1388
+ };
1925
1389
  };
1926
- var serializeAws_restJson1RecordPatchList = function (input, context) {
1390
+ const serializeAws_restJson1RecordPatchList = (input, context) => {
1927
1391
  return input
1928
- .filter(function (e) { return e != null; })
1929
- .map(function (entry) {
1392
+ .filter((e) => e != null)
1393
+ .map((entry) => {
1930
1394
  return serializeAws_restJson1RecordPatch(entry, context);
1931
1395
  });
1932
1396
  };
1933
- var deserializeAws_restJson1ApplicationArnList = function (output, context) {
1934
- var retVal = (output || [])
1935
- .filter(function (e) { return e != null; })
1936
- .map(function (entry) {
1397
+ const deserializeAws_restJson1ApplicationArnList = (output, context) => {
1398
+ const retVal = (output || [])
1399
+ .filter((e) => e != null)
1400
+ .map((entry) => {
1937
1401
  if (entry === null) {
1938
1402
  return null;
1939
1403
  }
@@ -1941,14 +1405,14 @@ var deserializeAws_restJson1ApplicationArnList = function (output, context) {
1941
1405
  });
1942
1406
  return retVal;
1943
1407
  };
1944
- var deserializeAws_restJson1CognitoStreams = function (output, context) {
1408
+ const deserializeAws_restJson1CognitoStreams = (output, context) => {
1945
1409
  return {
1946
1410
  RoleArn: __expectString(output.RoleArn),
1947
1411
  StreamName: __expectString(output.StreamName),
1948
1412
  StreamingStatus: __expectString(output.StreamingStatus),
1949
1413
  };
1950
1414
  };
1951
- var deserializeAws_restJson1Dataset = function (output, context) {
1415
+ const deserializeAws_restJson1Dataset = (output, context) => {
1952
1416
  return {
1953
1417
  CreationDate: output.CreationDate != null
1954
1418
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationDate)))
@@ -1963,10 +1427,10 @@ var deserializeAws_restJson1Dataset = function (output, context) {
1963
1427
  NumRecords: __expectLong(output.NumRecords),
1964
1428
  };
1965
1429
  };
1966
- var deserializeAws_restJson1DatasetList = function (output, context) {
1967
- var retVal = (output || [])
1968
- .filter(function (e) { return e != null; })
1969
- .map(function (entry) {
1430
+ const deserializeAws_restJson1DatasetList = (output, context) => {
1431
+ const retVal = (output || [])
1432
+ .filter((e) => e != null)
1433
+ .map((entry) => {
1970
1434
  if (entry === null) {
1971
1435
  return null;
1972
1436
  }
@@ -1974,17 +1438,18 @@ var deserializeAws_restJson1DatasetList = function (output, context) {
1974
1438
  });
1975
1439
  return retVal;
1976
1440
  };
1977
- var deserializeAws_restJson1Events = function (output, context) {
1978
- return Object.entries(output).reduce(function (acc, _a) {
1979
- var _b;
1980
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1441
+ const deserializeAws_restJson1Events = (output, context) => {
1442
+ return Object.entries(output).reduce((acc, [key, value]) => {
1981
1443
  if (value === null) {
1982
1444
  return acc;
1983
1445
  }
1984
- return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1446
+ return {
1447
+ ...acc,
1448
+ [key]: __expectString(value),
1449
+ };
1985
1450
  }, {});
1986
1451
  };
1987
- var deserializeAws_restJson1IdentityPoolUsage = function (output, context) {
1452
+ const deserializeAws_restJson1IdentityPoolUsage = (output, context) => {
1988
1453
  return {
1989
1454
  DataStorage: __expectLong(output.DataStorage),
1990
1455
  IdentityPoolId: __expectString(output.IdentityPoolId),
@@ -1994,10 +1459,10 @@ var deserializeAws_restJson1IdentityPoolUsage = function (output, context) {
1994
1459
  SyncSessionsCount: __expectLong(output.SyncSessionsCount),
1995
1460
  };
1996
1461
  };
1997
- var deserializeAws_restJson1IdentityPoolUsageList = function (output, context) {
1998
- var retVal = (output || [])
1999
- .filter(function (e) { return e != null; })
2000
- .map(function (entry) {
1462
+ const deserializeAws_restJson1IdentityPoolUsageList = (output, context) => {
1463
+ const retVal = (output || [])
1464
+ .filter((e) => e != null)
1465
+ .map((entry) => {
2001
1466
  if (entry === null) {
2002
1467
  return null;
2003
1468
  }
@@ -2005,7 +1470,7 @@ var deserializeAws_restJson1IdentityPoolUsageList = function (output, context) {
2005
1470
  });
2006
1471
  return retVal;
2007
1472
  };
2008
- var deserializeAws_restJson1IdentityUsage = function (output, context) {
1473
+ const deserializeAws_restJson1IdentityUsage = (output, context) => {
2009
1474
  return {
2010
1475
  DataStorage: __expectLong(output.DataStorage),
2011
1476
  DatasetCount: __expectInt32(output.DatasetCount),
@@ -2016,10 +1481,10 @@ var deserializeAws_restJson1IdentityUsage = function (output, context) {
2016
1481
  : undefined,
2017
1482
  };
2018
1483
  };
2019
- var deserializeAws_restJson1MergedDatasetNameList = function (output, context) {
2020
- var retVal = (output || [])
2021
- .filter(function (e) { return e != null; })
2022
- .map(function (entry) {
1484
+ const deserializeAws_restJson1MergedDatasetNameList = (output, context) => {
1485
+ const retVal = (output || [])
1486
+ .filter((e) => e != null)
1487
+ .map((entry) => {
2023
1488
  if (entry === null) {
2024
1489
  return null;
2025
1490
  }
@@ -2027,7 +1492,7 @@ var deserializeAws_restJson1MergedDatasetNameList = function (output, context) {
2027
1492
  });
2028
1493
  return retVal;
2029
1494
  };
2030
- var deserializeAws_restJson1PushSync = function (output, context) {
1495
+ const deserializeAws_restJson1PushSync = (output, context) => {
2031
1496
  return {
2032
1497
  ApplicationArns: output.ApplicationArns != null
2033
1498
  ? deserializeAws_restJson1ApplicationArnList(output.ApplicationArns, context)
@@ -2035,7 +1500,7 @@ var deserializeAws_restJson1PushSync = function (output, context) {
2035
1500
  RoleArn: __expectString(output.RoleArn),
2036
1501
  };
2037
1502
  };
2038
- var deserializeAws_restJson1_Record = function (output, context) {
1503
+ const deserializeAws_restJson1_Record = (output, context) => {
2039
1504
  return {
2040
1505
  DeviceLastModifiedDate: output.DeviceLastModifiedDate != null
2041
1506
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.DeviceLastModifiedDate)))
@@ -2049,10 +1514,10 @@ var deserializeAws_restJson1_Record = function (output, context) {
2049
1514
  Value: __expectString(output.Value),
2050
1515
  };
2051
1516
  };
2052
- var deserializeAws_restJson1RecordList = function (output, context) {
2053
- var retVal = (output || [])
2054
- .filter(function (e) { return e != null; })
2055
- .map(function (entry) {
1517
+ const deserializeAws_restJson1RecordList = (output, context) => {
1518
+ const retVal = (output || [])
1519
+ .filter((e) => e != null)
1520
+ .map((entry) => {
2056
1521
  if (entry === null) {
2057
1522
  return null;
2058
1523
  }
@@ -2060,57 +1525,39 @@ var deserializeAws_restJson1RecordList = function (output, context) {
2060
1525
  });
2061
1526
  return retVal;
2062
1527
  };
2063
- var deserializeMetadata = function (output) {
2064
- var _a;
2065
- return ({
2066
- httpStatusCode: output.statusCode,
2067
- requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
2068
- extendedRequestId: output.headers["x-amz-id-2"],
2069
- cfId: output.headers["x-amz-cf-id"],
2070
- });
2071
- };
2072
- var collectBody = function (streamBody, context) {
2073
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
1528
+ const deserializeMetadata = (output) => ({
1529
+ httpStatusCode: output.statusCode,
1530
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
1531
+ extendedRequestId: output.headers["x-amz-id-2"],
1532
+ cfId: output.headers["x-amz-cf-id"],
1533
+ });
1534
+ const collectBody = (streamBody = new Uint8Array(), context) => {
2074
1535
  if (streamBody instanceof Uint8Array) {
2075
1536
  return Promise.resolve(streamBody);
2076
1537
  }
2077
1538
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
2078
1539
  };
2079
- var collectBodyString = function (streamBody, context) {
2080
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
2081
- };
2082
- var isSerializableHeaderValue = function (value) {
2083
- return value !== undefined &&
2084
- value !== null &&
2085
- value !== "" &&
2086
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
2087
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
2088
- };
2089
- var parseBody = function (streamBody, context) {
2090
- return collectBodyString(streamBody, context).then(function (encoded) {
2091
- if (encoded.length) {
2092
- return JSON.parse(encoded);
2093
- }
2094
- return {};
2095
- });
1540
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1541
+ const isSerializableHeaderValue = (value) => value !== undefined &&
1542
+ value !== null &&
1543
+ value !== "" &&
1544
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1545
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1546
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1547
+ if (encoded.length) {
1548
+ return JSON.parse(encoded);
1549
+ }
1550
+ return {};
1551
+ });
1552
+ const parseErrorBody = async (errorBody, context) => {
1553
+ const value = await parseBody(errorBody, context);
1554
+ value.message = value.message ?? value.Message;
1555
+ return value;
2096
1556
  };
2097
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
2098
- var value;
2099
- var _a;
2100
- return __generator(this, function (_b) {
2101
- switch (_b.label) {
2102
- case 0: return [4, parseBody(errorBody, context)];
2103
- case 1:
2104
- value = _b.sent();
2105
- value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
2106
- return [2, value];
2107
- }
2108
- });
2109
- }); };
2110
- var loadRestJsonErrorCode = function (output, data) {
2111
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
2112
- var sanitizeErrorCode = function (rawValue) {
2113
- var cleanValue = rawValue;
1557
+ const loadRestJsonErrorCode = (output, data) => {
1558
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1559
+ const sanitizeErrorCode = (rawValue) => {
1560
+ let cleanValue = rawValue;
2114
1561
  if (typeof cleanValue === "number") {
2115
1562
  cleanValue = cleanValue.toString();
2116
1563
  }
@@ -2125,7 +1572,7 @@ var loadRestJsonErrorCode = function (output, data) {
2125
1572
  }
2126
1573
  return cleanValue;
2127
1574
  };
2128
- var headerKey = findKey(output.headers, "x-amzn-errortype");
1575
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
2129
1576
  if (headerKey !== undefined) {
2130
1577
  return sanitizeErrorCode(output.headers[headerKey]);
2131
1578
  }