@aws-sdk/client-ivs-realtime 3.298.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 (115) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +373 -0
  3. package/dist-cjs/IVSRealTime.js +157 -0
  4. package/dist-cjs/IVSRealTimeClient.js +40 -0
  5. package/dist-cjs/commands/CreateParticipantTokenCommand.js +45 -0
  6. package/dist-cjs/commands/CreateStageCommand.js +45 -0
  7. package/dist-cjs/commands/DeleteStageCommand.js +45 -0
  8. package/dist-cjs/commands/DisconnectParticipantCommand.js +45 -0
  9. package/dist-cjs/commands/GetStageCommand.js +45 -0
  10. package/dist-cjs/commands/ListStagesCommand.js +45 -0
  11. package/dist-cjs/commands/ListTagsForResourceCommand.js +45 -0
  12. package/dist-cjs/commands/TagResourceCommand.js +45 -0
  13. package/dist-cjs/commands/UntagResourceCommand.js +45 -0
  14. package/dist-cjs/commands/UpdateStageCommand.js +45 -0
  15. package/dist-cjs/commands/index.js +13 -0
  16. package/dist-cjs/endpoint/EndpointParameters.js +12 -0
  17. package/dist-cjs/endpoint/endpointResolver.js +12 -0
  18. package/dist-cjs/endpoint/ruleset.js +7 -0
  19. package/dist-cjs/index.js +11 -0
  20. package/dist-cjs/models/IVSRealTimeServiceException.js +11 -0
  21. package/dist-cjs/models/index.js +4 -0
  22. package/dist-cjs/models/models_0.js +107 -0
  23. package/dist-cjs/pagination/Interfaces.js +2 -0
  24. package/dist-cjs/pagination/ListStagesPaginator.js +29 -0
  25. package/dist-cjs/pagination/index.js +5 -0
  26. package/dist-cjs/protocols/Aws_restJson1.js +922 -0
  27. package/dist-cjs/runtimeConfig.browser.js +39 -0
  28. package/dist-cjs/runtimeConfig.js +48 -0
  29. package/dist-cjs/runtimeConfig.native.js +15 -0
  30. package/dist-cjs/runtimeConfig.shared.js +21 -0
  31. package/dist-es/IVSRealTime.js +153 -0
  32. package/dist-es/IVSRealTimeClient.js +36 -0
  33. package/dist-es/commands/CreateParticipantTokenCommand.js +41 -0
  34. package/dist-es/commands/CreateStageCommand.js +41 -0
  35. package/dist-es/commands/DeleteStageCommand.js +41 -0
  36. package/dist-es/commands/DisconnectParticipantCommand.js +41 -0
  37. package/dist-es/commands/GetStageCommand.js +41 -0
  38. package/dist-es/commands/ListStagesCommand.js +41 -0
  39. package/dist-es/commands/ListTagsForResourceCommand.js +41 -0
  40. package/dist-es/commands/TagResourceCommand.js +41 -0
  41. package/dist-es/commands/UntagResourceCommand.js +41 -0
  42. package/dist-es/commands/UpdateStageCommand.js +41 -0
  43. package/dist-es/commands/index.js +10 -0
  44. package/dist-es/endpoint/EndpointParameters.js +8 -0
  45. package/dist-es/endpoint/endpointResolver.js +8 -0
  46. package/dist-es/endpoint/ruleset.js +4 -0
  47. package/dist-es/index.js +6 -0
  48. package/dist-es/models/IVSRealTimeServiceException.js +7 -0
  49. package/dist-es/models/index.js +1 -0
  50. package/dist-es/models/models_0.js +97 -0
  51. package/dist-es/pagination/Interfaces.js +1 -0
  52. package/dist-es/pagination/ListStagesPaginator.js +25 -0
  53. package/dist-es/pagination/index.js +2 -0
  54. package/dist-es/protocols/Aws_restJson1.js +899 -0
  55. package/dist-es/runtimeConfig.browser.js +34 -0
  56. package/dist-es/runtimeConfig.js +43 -0
  57. package/dist-es/runtimeConfig.native.js +11 -0
  58. package/dist-es/runtimeConfig.shared.js +17 -0
  59. package/dist-types/IVSRealTime.d.ts +175 -0
  60. package/dist-types/IVSRealTimeClient.d.ts +256 -0
  61. package/dist-types/commands/CreateParticipantTokenCommand.d.ts +77 -0
  62. package/dist-types/commands/CreateStageCommand.d.ts +72 -0
  63. package/dist-types/commands/DeleteStageCommand.d.ts +75 -0
  64. package/dist-types/commands/DisconnectParticipantCommand.d.ts +72 -0
  65. package/dist-types/commands/GetStageCommand.d.ts +69 -0
  66. package/dist-types/commands/ListStagesCommand.d.ts +69 -0
  67. package/dist-types/commands/ListTagsForResourceCommand.d.ts +69 -0
  68. package/dist-types/commands/TagResourceCommand.d.ts +69 -0
  69. package/dist-types/commands/UntagResourceCommand.d.ts +69 -0
  70. package/dist-types/commands/UpdateStageCommand.d.ts +75 -0
  71. package/dist-types/commands/index.d.ts +10 -0
  72. package/dist-types/endpoint/EndpointParameters.d.ts +19 -0
  73. package/dist-types/endpoint/endpointResolver.d.ts +5 -0
  74. package/dist-types/endpoint/ruleset.d.ts +2 -0
  75. package/dist-types/index.d.ts +6 -0
  76. package/dist-types/models/IVSRealTimeServiceException.d.ts +12 -0
  77. package/dist-types/models/index.d.ts +1 -0
  78. package/dist-types/models/models_0.d.ts +477 -0
  79. package/dist-types/pagination/Interfaces.d.ts +8 -0
  80. package/dist-types/pagination/ListStagesPaginator.d.ts +7 -0
  81. package/dist-types/pagination/index.d.ts +2 -0
  82. package/dist-types/protocols/Aws_restJson1.d.ts +32 -0
  83. package/dist-types/runtimeConfig.browser.d.ts +42 -0
  84. package/dist-types/runtimeConfig.d.ts +42 -0
  85. package/dist-types/runtimeConfig.native.d.ts +41 -0
  86. package/dist-types/runtimeConfig.shared.d.ts +18 -0
  87. package/dist-types/ts3.4/IVSRealTime.d.ts +174 -0
  88. package/dist-types/ts3.4/IVSRealTimeClient.d.ts +172 -0
  89. package/dist-types/ts3.4/commands/CreateParticipantTokenCommand.d.ts +41 -0
  90. package/dist-types/ts3.4/commands/CreateStageCommand.d.ts +34 -0
  91. package/dist-types/ts3.4/commands/DeleteStageCommand.d.ts +34 -0
  92. package/dist-types/ts3.4/commands/DisconnectParticipantCommand.d.ts +41 -0
  93. package/dist-types/ts3.4/commands/GetStageCommand.d.ts +34 -0
  94. package/dist-types/ts3.4/commands/ListStagesCommand.d.ts +34 -0
  95. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +38 -0
  96. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +34 -0
  97. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +37 -0
  98. package/dist-types/ts3.4/commands/UpdateStageCommand.d.ts +34 -0
  99. package/dist-types/ts3.4/commands/index.d.ts +10 -0
  100. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +33 -0
  101. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  102. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  103. package/dist-types/ts3.4/index.d.ts +6 -0
  104. package/dist-types/ts3.4/models/IVSRealTimeServiceException.d.ts +7 -0
  105. package/dist-types/ts3.4/models/index.d.ts +1 -0
  106. package/dist-types/ts3.4/models/models_0.d.ts +153 -0
  107. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  108. package/dist-types/ts3.4/pagination/ListStagesPaginator.d.ts +11 -0
  109. package/dist-types/ts3.4/pagination/index.d.ts +2 -0
  110. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +125 -0
  111. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +91 -0
  112. package/dist-types/ts3.4/runtimeConfig.d.ts +91 -0
  113. package/dist-types/ts3.4/runtimeConfig.native.d.ts +80 -0
  114. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +18 -0
  115. package/package.json +98 -0
@@ -0,0 +1,922 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeAws_restJson1UpdateStageCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListStagesCommand = exports.deserializeAws_restJson1GetStageCommand = exports.deserializeAws_restJson1DisconnectParticipantCommand = exports.deserializeAws_restJson1DeleteStageCommand = exports.deserializeAws_restJson1CreateStageCommand = exports.deserializeAws_restJson1CreateParticipantTokenCommand = exports.serializeAws_restJson1UpdateStageCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListStagesCommand = exports.serializeAws_restJson1GetStageCommand = exports.serializeAws_restJson1DisconnectParticipantCommand = exports.serializeAws_restJson1DeleteStageCommand = exports.serializeAws_restJson1CreateStageCommand = exports.serializeAws_restJson1CreateParticipantTokenCommand = void 0;
4
+ const protocol_http_1 = require("@aws-sdk/protocol-http");
5
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const IVSRealTimeServiceException_1 = require("../models/IVSRealTimeServiceException");
7
+ const models_0_1 = require("../models/models_0");
8
+ const serializeAws_restJson1CreateParticipantTokenCommand = async (input, context) => {
9
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
+ const headers = {
11
+ "content-type": "application/json",
12
+ };
13
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateParticipantToken";
14
+ let body;
15
+ body = JSON.stringify({
16
+ ...(input.attributes != null && {
17
+ attributes: serializeAws_restJson1ParticipantTokenAttributes(input.attributes, context),
18
+ }),
19
+ ...(input.capabilities != null && {
20
+ capabilities: serializeAws_restJson1ParticipantTokenCapabilities(input.capabilities, context),
21
+ }),
22
+ ...(input.duration != null && { duration: input.duration }),
23
+ ...(input.stageArn != null && { stageArn: input.stageArn }),
24
+ ...(input.userId != null && { userId: input.userId }),
25
+ });
26
+ return new protocol_http_1.HttpRequest({
27
+ protocol,
28
+ hostname,
29
+ port,
30
+ method: "POST",
31
+ headers,
32
+ path: resolvedPath,
33
+ body,
34
+ });
35
+ };
36
+ exports.serializeAws_restJson1CreateParticipantTokenCommand = serializeAws_restJson1CreateParticipantTokenCommand;
37
+ const serializeAws_restJson1CreateStageCommand = async (input, context) => {
38
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
39
+ const headers = {
40
+ "content-type": "application/json",
41
+ };
42
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateStage";
43
+ let body;
44
+ body = JSON.stringify({
45
+ ...(input.name != null && { name: input.name }),
46
+ ...(input.participantTokenConfigurations != null && {
47
+ participantTokenConfigurations: serializeAws_restJson1ParticipantTokenConfigurations(input.participantTokenConfigurations, context),
48
+ }),
49
+ ...(input.tags != null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
50
+ });
51
+ return new protocol_http_1.HttpRequest({
52
+ protocol,
53
+ hostname,
54
+ port,
55
+ method: "POST",
56
+ headers,
57
+ path: resolvedPath,
58
+ body,
59
+ });
60
+ };
61
+ exports.serializeAws_restJson1CreateStageCommand = serializeAws_restJson1CreateStageCommand;
62
+ const serializeAws_restJson1DeleteStageCommand = async (input, context) => {
63
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
64
+ const headers = {
65
+ "content-type": "application/json",
66
+ };
67
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteStage";
68
+ let body;
69
+ body = JSON.stringify({
70
+ ...(input.arn != null && { arn: input.arn }),
71
+ });
72
+ return new protocol_http_1.HttpRequest({
73
+ protocol,
74
+ hostname,
75
+ port,
76
+ method: "POST",
77
+ headers,
78
+ path: resolvedPath,
79
+ body,
80
+ });
81
+ };
82
+ exports.serializeAws_restJson1DeleteStageCommand = serializeAws_restJson1DeleteStageCommand;
83
+ const serializeAws_restJson1DisconnectParticipantCommand = async (input, context) => {
84
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
85
+ const headers = {
86
+ "content-type": "application/json",
87
+ };
88
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DisconnectParticipant";
89
+ let body;
90
+ body = JSON.stringify({
91
+ ...(input.participantId != null && { participantId: input.participantId }),
92
+ ...(input.reason != null && { reason: input.reason }),
93
+ ...(input.stageArn != null && { stageArn: input.stageArn }),
94
+ });
95
+ return new protocol_http_1.HttpRequest({
96
+ protocol,
97
+ hostname,
98
+ port,
99
+ method: "POST",
100
+ headers,
101
+ path: resolvedPath,
102
+ body,
103
+ });
104
+ };
105
+ exports.serializeAws_restJson1DisconnectParticipantCommand = serializeAws_restJson1DisconnectParticipantCommand;
106
+ const serializeAws_restJson1GetStageCommand = async (input, context) => {
107
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
108
+ const headers = {
109
+ "content-type": "application/json",
110
+ };
111
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetStage";
112
+ let body;
113
+ body = JSON.stringify({
114
+ ...(input.arn != null && { arn: input.arn }),
115
+ });
116
+ return new protocol_http_1.HttpRequest({
117
+ protocol,
118
+ hostname,
119
+ port,
120
+ method: "POST",
121
+ headers,
122
+ path: resolvedPath,
123
+ body,
124
+ });
125
+ };
126
+ exports.serializeAws_restJson1GetStageCommand = serializeAws_restJson1GetStageCommand;
127
+ const serializeAws_restJson1ListStagesCommand = async (input, context) => {
128
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
129
+ const headers = {
130
+ "content-type": "application/json",
131
+ };
132
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListStages";
133
+ let body;
134
+ body = JSON.stringify({
135
+ ...(input.maxResults != null && { maxResults: input.maxResults }),
136
+ ...(input.nextToken != null && { nextToken: input.nextToken }),
137
+ });
138
+ return new protocol_http_1.HttpRequest({
139
+ protocol,
140
+ hostname,
141
+ port,
142
+ method: "POST",
143
+ headers,
144
+ path: resolvedPath,
145
+ body,
146
+ });
147
+ };
148
+ exports.serializeAws_restJson1ListStagesCommand = serializeAws_restJson1ListStagesCommand;
149
+ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context) => {
150
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
151
+ const headers = {};
152
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
153
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
154
+ let body;
155
+ return new protocol_http_1.HttpRequest({
156
+ protocol,
157
+ hostname,
158
+ port,
159
+ method: "GET",
160
+ headers,
161
+ path: resolvedPath,
162
+ body,
163
+ });
164
+ };
165
+ exports.serializeAws_restJson1ListTagsForResourceCommand = serializeAws_restJson1ListTagsForResourceCommand;
166
+ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
167
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
168
+ const headers = {
169
+ "content-type": "application/json",
170
+ };
171
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
172
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
173
+ let body;
174
+ body = JSON.stringify({
175
+ ...(input.tags != null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
176
+ });
177
+ return new protocol_http_1.HttpRequest({
178
+ protocol,
179
+ hostname,
180
+ port,
181
+ method: "POST",
182
+ headers,
183
+ path: resolvedPath,
184
+ body,
185
+ });
186
+ };
187
+ exports.serializeAws_restJson1TagResourceCommand = serializeAws_restJson1TagResourceCommand;
188
+ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
189
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
190
+ const headers = {};
191
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
192
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
193
+ const query = map({
194
+ tagKeys: [
195
+ (0, smithy_client_1.expectNonNull)(input.tagKeys, `tagKeys`) != null,
196
+ () => (input.tagKeys || []).map((_entry) => _entry),
197
+ ],
198
+ });
199
+ let body;
200
+ return new protocol_http_1.HttpRequest({
201
+ protocol,
202
+ hostname,
203
+ port,
204
+ method: "DELETE",
205
+ headers,
206
+ path: resolvedPath,
207
+ query,
208
+ body,
209
+ });
210
+ };
211
+ exports.serializeAws_restJson1UntagResourceCommand = serializeAws_restJson1UntagResourceCommand;
212
+ const serializeAws_restJson1UpdateStageCommand = async (input, context) => {
213
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
214
+ const headers = {
215
+ "content-type": "application/json",
216
+ };
217
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateStage";
218
+ let body;
219
+ body = JSON.stringify({
220
+ ...(input.arn != null && { arn: input.arn }),
221
+ ...(input.name != null && { name: input.name }),
222
+ });
223
+ return new protocol_http_1.HttpRequest({
224
+ protocol,
225
+ hostname,
226
+ port,
227
+ method: "POST",
228
+ headers,
229
+ path: resolvedPath,
230
+ body,
231
+ });
232
+ };
233
+ exports.serializeAws_restJson1UpdateStageCommand = serializeAws_restJson1UpdateStageCommand;
234
+ const deserializeAws_restJson1CreateParticipantTokenCommand = async (output, context) => {
235
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
236
+ return deserializeAws_restJson1CreateParticipantTokenCommandError(output, context);
237
+ }
238
+ const contents = map({
239
+ $metadata: deserializeMetadata(output),
240
+ });
241
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
242
+ if (data.participantToken != null) {
243
+ contents.participantToken = deserializeAws_restJson1ParticipantToken(data.participantToken, context);
244
+ }
245
+ return contents;
246
+ };
247
+ exports.deserializeAws_restJson1CreateParticipantTokenCommand = deserializeAws_restJson1CreateParticipantTokenCommand;
248
+ const deserializeAws_restJson1CreateParticipantTokenCommandError = async (output, context) => {
249
+ const parsedOutput = {
250
+ ...output,
251
+ body: await parseErrorBody(output.body, context),
252
+ };
253
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
254
+ switch (errorCode) {
255
+ case "AccessDeniedException":
256
+ case "com.amazonaws.ivsrealtime#AccessDeniedException":
257
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
258
+ case "PendingVerification":
259
+ case "com.amazonaws.ivsrealtime#PendingVerification":
260
+ throw await deserializeAws_restJson1PendingVerificationResponse(parsedOutput, context);
261
+ case "ResourceNotFoundException":
262
+ case "com.amazonaws.ivsrealtime#ResourceNotFoundException":
263
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
264
+ case "ServiceQuotaExceededException":
265
+ case "com.amazonaws.ivsrealtime#ServiceQuotaExceededException":
266
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
267
+ case "ValidationException":
268
+ case "com.amazonaws.ivsrealtime#ValidationException":
269
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
270
+ default:
271
+ const parsedBody = parsedOutput.body;
272
+ (0, smithy_client_1.throwDefaultError)({
273
+ output,
274
+ parsedBody,
275
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
276
+ errorCode,
277
+ });
278
+ }
279
+ };
280
+ const deserializeAws_restJson1CreateStageCommand = async (output, context) => {
281
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
282
+ return deserializeAws_restJson1CreateStageCommandError(output, context);
283
+ }
284
+ const contents = map({
285
+ $metadata: deserializeMetadata(output),
286
+ });
287
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
288
+ if (data.participantTokens != null) {
289
+ contents.participantTokens = deserializeAws_restJson1ParticipantTokenList(data.participantTokens, context);
290
+ }
291
+ if (data.stage != null) {
292
+ contents.stage = deserializeAws_restJson1Stage(data.stage, context);
293
+ }
294
+ return contents;
295
+ };
296
+ exports.deserializeAws_restJson1CreateStageCommand = deserializeAws_restJson1CreateStageCommand;
297
+ const deserializeAws_restJson1CreateStageCommandError = async (output, context) => {
298
+ const parsedOutput = {
299
+ ...output,
300
+ body: await parseErrorBody(output.body, context),
301
+ };
302
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
303
+ switch (errorCode) {
304
+ case "AccessDeniedException":
305
+ case "com.amazonaws.ivsrealtime#AccessDeniedException":
306
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
307
+ case "PendingVerification":
308
+ case "com.amazonaws.ivsrealtime#PendingVerification":
309
+ throw await deserializeAws_restJson1PendingVerificationResponse(parsedOutput, context);
310
+ case "ServiceQuotaExceededException":
311
+ case "com.amazonaws.ivsrealtime#ServiceQuotaExceededException":
312
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
313
+ case "ValidationException":
314
+ case "com.amazonaws.ivsrealtime#ValidationException":
315
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
316
+ default:
317
+ const parsedBody = parsedOutput.body;
318
+ (0, smithy_client_1.throwDefaultError)({
319
+ output,
320
+ parsedBody,
321
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
322
+ errorCode,
323
+ });
324
+ }
325
+ };
326
+ const deserializeAws_restJson1DeleteStageCommand = async (output, context) => {
327
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
328
+ return deserializeAws_restJson1DeleteStageCommandError(output, context);
329
+ }
330
+ const contents = map({
331
+ $metadata: deserializeMetadata(output),
332
+ });
333
+ await collectBody(output.body, context);
334
+ return contents;
335
+ };
336
+ exports.deserializeAws_restJson1DeleteStageCommand = deserializeAws_restJson1DeleteStageCommand;
337
+ const deserializeAws_restJson1DeleteStageCommandError = async (output, context) => {
338
+ const parsedOutput = {
339
+ ...output,
340
+ body: await parseErrorBody(output.body, context),
341
+ };
342
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
343
+ switch (errorCode) {
344
+ case "AccessDeniedException":
345
+ case "com.amazonaws.ivsrealtime#AccessDeniedException":
346
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
347
+ case "ConflictException":
348
+ case "com.amazonaws.ivsrealtime#ConflictException":
349
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
350
+ case "PendingVerification":
351
+ case "com.amazonaws.ivsrealtime#PendingVerification":
352
+ throw await deserializeAws_restJson1PendingVerificationResponse(parsedOutput, context);
353
+ case "ResourceNotFoundException":
354
+ case "com.amazonaws.ivsrealtime#ResourceNotFoundException":
355
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
356
+ case "ValidationException":
357
+ case "com.amazonaws.ivsrealtime#ValidationException":
358
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
359
+ default:
360
+ const parsedBody = parsedOutput.body;
361
+ (0, smithy_client_1.throwDefaultError)({
362
+ output,
363
+ parsedBody,
364
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
365
+ errorCode,
366
+ });
367
+ }
368
+ };
369
+ const deserializeAws_restJson1DisconnectParticipantCommand = async (output, context) => {
370
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
371
+ return deserializeAws_restJson1DisconnectParticipantCommandError(output, context);
372
+ }
373
+ const contents = map({
374
+ $metadata: deserializeMetadata(output),
375
+ });
376
+ await collectBody(output.body, context);
377
+ return contents;
378
+ };
379
+ exports.deserializeAws_restJson1DisconnectParticipantCommand = deserializeAws_restJson1DisconnectParticipantCommand;
380
+ const deserializeAws_restJson1DisconnectParticipantCommandError = async (output, context) => {
381
+ const parsedOutput = {
382
+ ...output,
383
+ body: await parseErrorBody(output.body, context),
384
+ };
385
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
386
+ switch (errorCode) {
387
+ case "AccessDeniedException":
388
+ case "com.amazonaws.ivsrealtime#AccessDeniedException":
389
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
390
+ case "PendingVerification":
391
+ case "com.amazonaws.ivsrealtime#PendingVerification":
392
+ throw await deserializeAws_restJson1PendingVerificationResponse(parsedOutput, context);
393
+ case "ResourceNotFoundException":
394
+ case "com.amazonaws.ivsrealtime#ResourceNotFoundException":
395
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
396
+ case "ValidationException":
397
+ case "com.amazonaws.ivsrealtime#ValidationException":
398
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
399
+ default:
400
+ const parsedBody = parsedOutput.body;
401
+ (0, smithy_client_1.throwDefaultError)({
402
+ output,
403
+ parsedBody,
404
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
405
+ errorCode,
406
+ });
407
+ }
408
+ };
409
+ const deserializeAws_restJson1GetStageCommand = async (output, context) => {
410
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
411
+ return deserializeAws_restJson1GetStageCommandError(output, context);
412
+ }
413
+ const contents = map({
414
+ $metadata: deserializeMetadata(output),
415
+ });
416
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
417
+ if (data.stage != null) {
418
+ contents.stage = deserializeAws_restJson1Stage(data.stage, context);
419
+ }
420
+ return contents;
421
+ };
422
+ exports.deserializeAws_restJson1GetStageCommand = deserializeAws_restJson1GetStageCommand;
423
+ const deserializeAws_restJson1GetStageCommandError = async (output, context) => {
424
+ const parsedOutput = {
425
+ ...output,
426
+ body: await parseErrorBody(output.body, context),
427
+ };
428
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
429
+ switch (errorCode) {
430
+ case "AccessDeniedException":
431
+ case "com.amazonaws.ivsrealtime#AccessDeniedException":
432
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
433
+ case "ResourceNotFoundException":
434
+ case "com.amazonaws.ivsrealtime#ResourceNotFoundException":
435
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
436
+ case "ValidationException":
437
+ case "com.amazonaws.ivsrealtime#ValidationException":
438
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
439
+ default:
440
+ const parsedBody = parsedOutput.body;
441
+ (0, smithy_client_1.throwDefaultError)({
442
+ output,
443
+ parsedBody,
444
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
445
+ errorCode,
446
+ });
447
+ }
448
+ };
449
+ const deserializeAws_restJson1ListStagesCommand = async (output, context) => {
450
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
451
+ return deserializeAws_restJson1ListStagesCommandError(output, context);
452
+ }
453
+ const contents = map({
454
+ $metadata: deserializeMetadata(output),
455
+ });
456
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
457
+ if (data.nextToken != null) {
458
+ contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
459
+ }
460
+ if (data.stages != null) {
461
+ contents.stages = deserializeAws_restJson1StageSummaryList(data.stages, context);
462
+ }
463
+ return contents;
464
+ };
465
+ exports.deserializeAws_restJson1ListStagesCommand = deserializeAws_restJson1ListStagesCommand;
466
+ const deserializeAws_restJson1ListStagesCommandError = async (output, context) => {
467
+ const parsedOutput = {
468
+ ...output,
469
+ body: await parseErrorBody(output.body, context),
470
+ };
471
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
472
+ switch (errorCode) {
473
+ case "AccessDeniedException":
474
+ case "com.amazonaws.ivsrealtime#AccessDeniedException":
475
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
476
+ case "ConflictException":
477
+ case "com.amazonaws.ivsrealtime#ConflictException":
478
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
479
+ case "ValidationException":
480
+ case "com.amazonaws.ivsrealtime#ValidationException":
481
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
482
+ default:
483
+ const parsedBody = parsedOutput.body;
484
+ (0, smithy_client_1.throwDefaultError)({
485
+ output,
486
+ parsedBody,
487
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
488
+ errorCode,
489
+ });
490
+ }
491
+ };
492
+ const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
493
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
494
+ return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
495
+ }
496
+ const contents = map({
497
+ $metadata: deserializeMetadata(output),
498
+ });
499
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
500
+ if (data.tags != null) {
501
+ contents.tags = deserializeAws_restJson1Tags(data.tags, context);
502
+ }
503
+ return contents;
504
+ };
505
+ exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
506
+ const deserializeAws_restJson1ListTagsForResourceCommandError = 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 "InternalServerException":
514
+ case "com.amazonaws.ivsrealtime#InternalServerException":
515
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
516
+ case "ResourceNotFoundException":
517
+ case "com.amazonaws.ivsrealtime#ResourceNotFoundException":
518
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
519
+ case "ValidationException":
520
+ case "com.amazonaws.ivsrealtime#ValidationException":
521
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
522
+ default:
523
+ const parsedBody = parsedOutput.body;
524
+ (0, smithy_client_1.throwDefaultError)({
525
+ output,
526
+ parsedBody,
527
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
528
+ errorCode,
529
+ });
530
+ }
531
+ };
532
+ const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
533
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
534
+ return deserializeAws_restJson1TagResourceCommandError(output, context);
535
+ }
536
+ const contents = map({
537
+ $metadata: deserializeMetadata(output),
538
+ });
539
+ await collectBody(output.body, context);
540
+ return contents;
541
+ };
542
+ exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
543
+ const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
544
+ const parsedOutput = {
545
+ ...output,
546
+ body: await parseErrorBody(output.body, context),
547
+ };
548
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
549
+ switch (errorCode) {
550
+ case "InternalServerException":
551
+ case "com.amazonaws.ivsrealtime#InternalServerException":
552
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
553
+ case "ResourceNotFoundException":
554
+ case "com.amazonaws.ivsrealtime#ResourceNotFoundException":
555
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
556
+ case "ValidationException":
557
+ case "com.amazonaws.ivsrealtime#ValidationException":
558
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
559
+ default:
560
+ const parsedBody = parsedOutput.body;
561
+ (0, smithy_client_1.throwDefaultError)({
562
+ output,
563
+ parsedBody,
564
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
565
+ errorCode,
566
+ });
567
+ }
568
+ };
569
+ const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
570
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
571
+ return deserializeAws_restJson1UntagResourceCommandError(output, context);
572
+ }
573
+ const contents = map({
574
+ $metadata: deserializeMetadata(output),
575
+ });
576
+ await collectBody(output.body, context);
577
+ return contents;
578
+ };
579
+ exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
580
+ const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
581
+ const parsedOutput = {
582
+ ...output,
583
+ body: await parseErrorBody(output.body, context),
584
+ };
585
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
586
+ switch (errorCode) {
587
+ case "InternalServerException":
588
+ case "com.amazonaws.ivsrealtime#InternalServerException":
589
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
590
+ case "ResourceNotFoundException":
591
+ case "com.amazonaws.ivsrealtime#ResourceNotFoundException":
592
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
593
+ case "ValidationException":
594
+ case "com.amazonaws.ivsrealtime#ValidationException":
595
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
596
+ default:
597
+ const parsedBody = parsedOutput.body;
598
+ (0, smithy_client_1.throwDefaultError)({
599
+ output,
600
+ parsedBody,
601
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
602
+ errorCode,
603
+ });
604
+ }
605
+ };
606
+ const deserializeAws_restJson1UpdateStageCommand = async (output, context) => {
607
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
608
+ return deserializeAws_restJson1UpdateStageCommandError(output, context);
609
+ }
610
+ const contents = map({
611
+ $metadata: deserializeMetadata(output),
612
+ });
613
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
614
+ if (data.stage != null) {
615
+ contents.stage = deserializeAws_restJson1Stage(data.stage, context);
616
+ }
617
+ return contents;
618
+ };
619
+ exports.deserializeAws_restJson1UpdateStageCommand = deserializeAws_restJson1UpdateStageCommand;
620
+ const deserializeAws_restJson1UpdateStageCommandError = async (output, context) => {
621
+ const parsedOutput = {
622
+ ...output,
623
+ body: await parseErrorBody(output.body, context),
624
+ };
625
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
626
+ switch (errorCode) {
627
+ case "AccessDeniedException":
628
+ case "com.amazonaws.ivsrealtime#AccessDeniedException":
629
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
630
+ case "PendingVerification":
631
+ case "com.amazonaws.ivsrealtime#PendingVerification":
632
+ throw await deserializeAws_restJson1PendingVerificationResponse(parsedOutput, context);
633
+ case "ResourceNotFoundException":
634
+ case "com.amazonaws.ivsrealtime#ResourceNotFoundException":
635
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
636
+ case "ServiceQuotaExceededException":
637
+ case "com.amazonaws.ivsrealtime#ServiceQuotaExceededException":
638
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
639
+ case "ValidationException":
640
+ case "com.amazonaws.ivsrealtime#ValidationException":
641
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
642
+ default:
643
+ const parsedBody = parsedOutput.body;
644
+ (0, smithy_client_1.throwDefaultError)({
645
+ output,
646
+ parsedBody,
647
+ exceptionCtor: IVSRealTimeServiceException_1.IVSRealTimeServiceException,
648
+ errorCode,
649
+ });
650
+ }
651
+ };
652
+ const map = smithy_client_1.map;
653
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
654
+ const contents = map({});
655
+ const data = parsedOutput.body;
656
+ if (data.exceptionMessage != null) {
657
+ contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
658
+ }
659
+ const exception = new models_0_1.AccessDeniedException({
660
+ $metadata: deserializeMetadata(parsedOutput),
661
+ ...contents,
662
+ });
663
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
664
+ };
665
+ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
666
+ const contents = map({});
667
+ const data = parsedOutput.body;
668
+ if (data.exceptionMessage != null) {
669
+ contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
670
+ }
671
+ const exception = new models_0_1.ConflictException({
672
+ $metadata: deserializeMetadata(parsedOutput),
673
+ ...contents,
674
+ });
675
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
676
+ };
677
+ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
678
+ const contents = map({});
679
+ const data = parsedOutput.body;
680
+ if (data.exceptionMessage != null) {
681
+ contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
682
+ }
683
+ const exception = new models_0_1.InternalServerException({
684
+ $metadata: deserializeMetadata(parsedOutput),
685
+ ...contents,
686
+ });
687
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
688
+ };
689
+ const deserializeAws_restJson1PendingVerificationResponse = async (parsedOutput, context) => {
690
+ const contents = map({});
691
+ const data = parsedOutput.body;
692
+ if (data.exceptionMessage != null) {
693
+ contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
694
+ }
695
+ const exception = new models_0_1.PendingVerification({
696
+ $metadata: deserializeMetadata(parsedOutput),
697
+ ...contents,
698
+ });
699
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
700
+ };
701
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
702
+ const contents = map({});
703
+ const data = parsedOutput.body;
704
+ if (data.exceptionMessage != null) {
705
+ contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
706
+ }
707
+ const exception = new models_0_1.ResourceNotFoundException({
708
+ $metadata: deserializeMetadata(parsedOutput),
709
+ ...contents,
710
+ });
711
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
712
+ };
713
+ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
714
+ const contents = map({});
715
+ const data = parsedOutput.body;
716
+ if (data.exceptionMessage != null) {
717
+ contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
718
+ }
719
+ const exception = new models_0_1.ServiceQuotaExceededException({
720
+ $metadata: deserializeMetadata(parsedOutput),
721
+ ...contents,
722
+ });
723
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
724
+ };
725
+ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
726
+ const contents = map({});
727
+ const data = parsedOutput.body;
728
+ if (data.exceptionMessage != null) {
729
+ contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
730
+ }
731
+ const exception = new models_0_1.ValidationException({
732
+ $metadata: deserializeMetadata(parsedOutput),
733
+ ...contents,
734
+ });
735
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
736
+ };
737
+ const serializeAws_restJson1ParticipantTokenAttributes = (input, context) => {
738
+ return Object.entries(input).reduce((acc, [key, value]) => {
739
+ if (value === null) {
740
+ return acc;
741
+ }
742
+ acc[key] = value;
743
+ return acc;
744
+ }, {});
745
+ };
746
+ const serializeAws_restJson1ParticipantTokenCapabilities = (input, context) => {
747
+ return input
748
+ .filter((e) => e != null)
749
+ .map((entry) => {
750
+ return entry;
751
+ });
752
+ };
753
+ const serializeAws_restJson1ParticipantTokenConfiguration = (input, context) => {
754
+ return {
755
+ ...(input.attributes != null && {
756
+ attributes: serializeAws_restJson1ParticipantTokenAttributes(input.attributes, context),
757
+ }),
758
+ ...(input.capabilities != null && {
759
+ capabilities: serializeAws_restJson1ParticipantTokenCapabilities(input.capabilities, context),
760
+ }),
761
+ ...(input.duration != null && { duration: input.duration }),
762
+ ...(input.userId != null && { userId: input.userId }),
763
+ };
764
+ };
765
+ const serializeAws_restJson1ParticipantTokenConfigurations = (input, context) => {
766
+ return input
767
+ .filter((e) => e != null)
768
+ .map((entry) => {
769
+ return serializeAws_restJson1ParticipantTokenConfiguration(entry, context);
770
+ });
771
+ };
772
+ const serializeAws_restJson1Tags = (input, context) => {
773
+ return Object.entries(input).reduce((acc, [key, value]) => {
774
+ if (value === null) {
775
+ return acc;
776
+ }
777
+ acc[key] = value;
778
+ return acc;
779
+ }, {});
780
+ };
781
+ const deserializeAws_restJson1ParticipantToken = (output, context) => {
782
+ return {
783
+ attributes: output.attributes != null
784
+ ? deserializeAws_restJson1ParticipantTokenAttributes(output.attributes, context)
785
+ : undefined,
786
+ capabilities: output.capabilities != null
787
+ ? deserializeAws_restJson1ParticipantTokenCapabilities(output.capabilities, context)
788
+ : undefined,
789
+ duration: (0, smithy_client_1.expectInt32)(output.duration),
790
+ expirationTime: output.expirationTime != null
791
+ ? (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(output.expirationTime)))
792
+ : undefined,
793
+ participantId: (0, smithy_client_1.expectString)(output.participantId),
794
+ token: (0, smithy_client_1.expectString)(output.token),
795
+ userId: (0, smithy_client_1.expectString)(output.userId),
796
+ };
797
+ };
798
+ const deserializeAws_restJson1ParticipantTokenAttributes = (output, context) => {
799
+ return Object.entries(output).reduce((acc, [key, value]) => {
800
+ if (value === null) {
801
+ return acc;
802
+ }
803
+ acc[key] = (0, smithy_client_1.expectString)(value);
804
+ return acc;
805
+ }, {});
806
+ };
807
+ const deserializeAws_restJson1ParticipantTokenCapabilities = (output, context) => {
808
+ const retVal = (output || [])
809
+ .filter((e) => e != null)
810
+ .map((entry) => {
811
+ if (entry === null) {
812
+ return null;
813
+ }
814
+ return (0, smithy_client_1.expectString)(entry);
815
+ });
816
+ return retVal;
817
+ };
818
+ const deserializeAws_restJson1ParticipantTokenList = (output, context) => {
819
+ const retVal = (output || [])
820
+ .filter((e) => e != null)
821
+ .map((entry) => {
822
+ if (entry === null) {
823
+ return null;
824
+ }
825
+ return deserializeAws_restJson1ParticipantToken(entry, context);
826
+ });
827
+ return retVal;
828
+ };
829
+ const deserializeAws_restJson1Stage = (output, context) => {
830
+ return {
831
+ activeSessionId: (0, smithy_client_1.expectString)(output.activeSessionId),
832
+ arn: (0, smithy_client_1.expectString)(output.arn),
833
+ name: (0, smithy_client_1.expectString)(output.name),
834
+ tags: output.tags != null ? deserializeAws_restJson1Tags(output.tags, context) : undefined,
835
+ };
836
+ };
837
+ const deserializeAws_restJson1StageSummary = (output, context) => {
838
+ return {
839
+ activeSessionId: (0, smithy_client_1.expectString)(output.activeSessionId),
840
+ arn: (0, smithy_client_1.expectString)(output.arn),
841
+ name: (0, smithy_client_1.expectString)(output.name),
842
+ tags: output.tags != null ? deserializeAws_restJson1Tags(output.tags, context) : undefined,
843
+ };
844
+ };
845
+ const deserializeAws_restJson1StageSummaryList = (output, context) => {
846
+ const retVal = (output || [])
847
+ .filter((e) => e != null)
848
+ .map((entry) => {
849
+ if (entry === null) {
850
+ return null;
851
+ }
852
+ return deserializeAws_restJson1StageSummary(entry, context);
853
+ });
854
+ return retVal;
855
+ };
856
+ const deserializeAws_restJson1Tags = (output, context) => {
857
+ return Object.entries(output).reduce((acc, [key, value]) => {
858
+ if (value === null) {
859
+ return acc;
860
+ }
861
+ acc[key] = (0, smithy_client_1.expectString)(value);
862
+ return acc;
863
+ }, {});
864
+ };
865
+ const deserializeMetadata = (output) => ({
866
+ httpStatusCode: output.statusCode,
867
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
868
+ extendedRequestId: output.headers["x-amz-id-2"],
869
+ cfId: output.headers["x-amz-cf-id"],
870
+ });
871
+ const collectBody = (streamBody = new Uint8Array(), context) => {
872
+ if (streamBody instanceof Uint8Array) {
873
+ return Promise.resolve(streamBody);
874
+ }
875
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
876
+ };
877
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
878
+ const isSerializableHeaderValue = (value) => value !== undefined &&
879
+ value !== null &&
880
+ value !== "" &&
881
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
882
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
883
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
884
+ if (encoded.length) {
885
+ return JSON.parse(encoded);
886
+ }
887
+ return {};
888
+ });
889
+ const parseErrorBody = async (errorBody, context) => {
890
+ const value = await parseBody(errorBody, context);
891
+ value.message = value.message ?? value.Message;
892
+ return value;
893
+ };
894
+ const loadRestJsonErrorCode = (output, data) => {
895
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
896
+ const sanitizeErrorCode = (rawValue) => {
897
+ let cleanValue = rawValue;
898
+ if (typeof cleanValue === "number") {
899
+ cleanValue = cleanValue.toString();
900
+ }
901
+ if (cleanValue.indexOf(",") >= 0) {
902
+ cleanValue = cleanValue.split(",")[0];
903
+ }
904
+ if (cleanValue.indexOf(":") >= 0) {
905
+ cleanValue = cleanValue.split(":")[0];
906
+ }
907
+ if (cleanValue.indexOf("#") >= 0) {
908
+ cleanValue = cleanValue.split("#")[1];
909
+ }
910
+ return cleanValue;
911
+ };
912
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
913
+ if (headerKey !== undefined) {
914
+ return sanitizeErrorCode(output.headers[headerKey]);
915
+ }
916
+ if (data.code !== undefined) {
917
+ return sanitizeErrorCode(data.code);
918
+ }
919
+ if (data["__type"] !== undefined) {
920
+ return sanitizeErrorCode(data["__type"]);
921
+ }
922
+ };