@aws-sdk/client-transcribe-streaming 3.183.0 → 3.185.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,465 +1,598 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map as __map, parseBoolean as __parseBoolean, strictParseInt32 as __strictParseInt32, throwDefaultError, } from "@aws-sdk/smithy-client";
3
4
  import { AudioStream, BadRequestException, ConflictException, InternalFailureException, LimitExceededException, ServiceUnavailableException, } from "../models/models_0";
4
5
  import { TranscribeStreamingServiceException as __BaseException } from "../models/TranscribeStreamingServiceException";
5
- export const serializeAws_restJson1StartMedicalStreamTranscriptionCommand = async (input, context) => {
6
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
- const headers = map({}, isSerializableHeaderValue, {
8
- "x-amzn-transcribe-language-code": input.LanguageCode,
9
- "x-amzn-transcribe-sample-rate": [
10
- () => isSerializableHeaderValue(input.MediaSampleRateHertz),
11
- () => input.MediaSampleRateHertz.toString(),
12
- ],
13
- "x-amzn-transcribe-media-encoding": input.MediaEncoding,
14
- "x-amzn-transcribe-vocabulary-name": input.VocabularyName,
15
- "x-amzn-transcribe-specialty": input.Specialty,
16
- "x-amzn-transcribe-type": input.Type,
17
- "x-amzn-transcribe-show-speaker-label": [
18
- () => isSerializableHeaderValue(input.ShowSpeakerLabel),
19
- () => input.ShowSpeakerLabel.toString(),
20
- ],
21
- "x-amzn-transcribe-session-id": input.SessionId,
22
- "x-amzn-transcribe-enable-channel-identification": [
23
- () => isSerializableHeaderValue(input.EnableChannelIdentification),
24
- () => input.EnableChannelIdentification.toString(),
25
- ],
26
- "x-amzn-transcribe-number-of-channels": [
27
- () => isSerializableHeaderValue(input.NumberOfChannels),
28
- () => input.NumberOfChannels.toString(),
29
- ],
30
- "x-amzn-transcribe-content-identification-type": input.ContentIdentificationType,
31
- });
32
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/medical-stream-transcription";
33
- let body;
34
- if (input.AudioStream !== undefined) {
35
- body = serializeAws_restJson1AudioStream(input.AudioStream, context);
36
- }
37
- return new __HttpRequest({
38
- protocol,
39
- hostname,
40
- port,
41
- method: "POST",
42
- headers,
43
- path: resolvedPath,
44
- body,
6
+ export var serializeAws_restJson1StartMedicalStreamTranscriptionCommand = 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 = map({}, isSerializableHeaderValue, {
14
+ "x-amzn-transcribe-language-code": input.LanguageCode,
15
+ "x-amzn-transcribe-sample-rate": [
16
+ function () { return isSerializableHeaderValue(input.MediaSampleRateHertz); },
17
+ function () { return input.MediaSampleRateHertz.toString(); },
18
+ ],
19
+ "x-amzn-transcribe-media-encoding": input.MediaEncoding,
20
+ "x-amzn-transcribe-vocabulary-name": input.VocabularyName,
21
+ "x-amzn-transcribe-specialty": input.Specialty,
22
+ "x-amzn-transcribe-type": input.Type,
23
+ "x-amzn-transcribe-show-speaker-label": [
24
+ function () { return isSerializableHeaderValue(input.ShowSpeakerLabel); },
25
+ function () { return input.ShowSpeakerLabel.toString(); },
26
+ ],
27
+ "x-amzn-transcribe-session-id": input.SessionId,
28
+ "x-amzn-transcribe-enable-channel-identification": [
29
+ function () { return isSerializableHeaderValue(input.EnableChannelIdentification); },
30
+ function () { return input.EnableChannelIdentification.toString(); },
31
+ ],
32
+ "x-amzn-transcribe-number-of-channels": [
33
+ function () { return isSerializableHeaderValue(input.NumberOfChannels); },
34
+ function () { return input.NumberOfChannels.toString(); },
35
+ ],
36
+ "x-amzn-transcribe-content-identification-type": input.ContentIdentificationType,
37
+ });
38
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/medical-stream-transcription";
39
+ if (input.AudioStream !== undefined) {
40
+ body = serializeAws_restJson1AudioStream(input.AudioStream, context);
41
+ }
42
+ return [2, new __HttpRequest({
43
+ protocol: protocol,
44
+ hostname: hostname,
45
+ port: port,
46
+ method: "POST",
47
+ headers: headers,
48
+ path: resolvedPath,
49
+ body: body,
50
+ })];
51
+ }
45
52
  });
46
- };
47
- export const serializeAws_restJson1StartStreamTranscriptionCommand = async (input, context) => {
48
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
49
- const headers = map({}, isSerializableHeaderValue, {
50
- "x-amzn-transcribe-language-code": input.LanguageCode,
51
- "x-amzn-transcribe-sample-rate": [
52
- () => isSerializableHeaderValue(input.MediaSampleRateHertz),
53
- () => input.MediaSampleRateHertz.toString(),
54
- ],
55
- "x-amzn-transcribe-media-encoding": input.MediaEncoding,
56
- "x-amzn-transcribe-vocabulary-name": input.VocabularyName,
57
- "x-amzn-transcribe-session-id": input.SessionId,
58
- "x-amzn-transcribe-vocabulary-filter-name": input.VocabularyFilterName,
59
- "x-amzn-transcribe-vocabulary-filter-method": input.VocabularyFilterMethod,
60
- "x-amzn-transcribe-show-speaker-label": [
61
- () => isSerializableHeaderValue(input.ShowSpeakerLabel),
62
- () => input.ShowSpeakerLabel.toString(),
63
- ],
64
- "x-amzn-transcribe-enable-channel-identification": [
65
- () => isSerializableHeaderValue(input.EnableChannelIdentification),
66
- () => input.EnableChannelIdentification.toString(),
67
- ],
68
- "x-amzn-transcribe-number-of-channels": [
69
- () => isSerializableHeaderValue(input.NumberOfChannels),
70
- () => input.NumberOfChannels.toString(),
71
- ],
72
- "x-amzn-transcribe-enable-partial-results-stabilization": [
73
- () => isSerializableHeaderValue(input.EnablePartialResultsStabilization),
74
- () => input.EnablePartialResultsStabilization.toString(),
75
- ],
76
- "x-amzn-transcribe-partial-results-stability": input.PartialResultsStability,
77
- "x-amzn-transcribe-content-identification-type": input.ContentIdentificationType,
78
- "x-amzn-transcribe-content-redaction-type": input.ContentRedactionType,
79
- "x-amzn-transcribe-pii-entity-types": input.PiiEntityTypes,
80
- "x-amzn-transcribe-language-model-name": input.LanguageModelName,
81
- "x-amzn-transcribe-identify-language": [
82
- () => isSerializableHeaderValue(input.IdentifyLanguage),
83
- () => input.IdentifyLanguage.toString(),
84
- ],
85
- "x-amzn-transcribe-language-options": input.LanguageOptions,
86
- "x-amzn-transcribe-preferred-language": input.PreferredLanguage,
87
- "x-amzn-transcribe-vocabulary-names": input.VocabularyNames,
88
- "x-amzn-transcribe-vocabulary-filter-names": input.VocabularyFilterNames,
53
+ }); };
54
+ export var serializeAws_restJson1StartStreamTranscriptionCommand = 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 = map({}, isSerializableHeaderValue, {
62
+ "x-amzn-transcribe-language-code": input.LanguageCode,
63
+ "x-amzn-transcribe-sample-rate": [
64
+ function () { return isSerializableHeaderValue(input.MediaSampleRateHertz); },
65
+ function () { return input.MediaSampleRateHertz.toString(); },
66
+ ],
67
+ "x-amzn-transcribe-media-encoding": input.MediaEncoding,
68
+ "x-amzn-transcribe-vocabulary-name": input.VocabularyName,
69
+ "x-amzn-transcribe-session-id": input.SessionId,
70
+ "x-amzn-transcribe-vocabulary-filter-name": input.VocabularyFilterName,
71
+ "x-amzn-transcribe-vocabulary-filter-method": input.VocabularyFilterMethod,
72
+ "x-amzn-transcribe-show-speaker-label": [
73
+ function () { return isSerializableHeaderValue(input.ShowSpeakerLabel); },
74
+ function () { return input.ShowSpeakerLabel.toString(); },
75
+ ],
76
+ "x-amzn-transcribe-enable-channel-identification": [
77
+ function () { return isSerializableHeaderValue(input.EnableChannelIdentification); },
78
+ function () { return input.EnableChannelIdentification.toString(); },
79
+ ],
80
+ "x-amzn-transcribe-number-of-channels": [
81
+ function () { return isSerializableHeaderValue(input.NumberOfChannels); },
82
+ function () { return input.NumberOfChannels.toString(); },
83
+ ],
84
+ "x-amzn-transcribe-enable-partial-results-stabilization": [
85
+ function () { return isSerializableHeaderValue(input.EnablePartialResultsStabilization); },
86
+ function () { return input.EnablePartialResultsStabilization.toString(); },
87
+ ],
88
+ "x-amzn-transcribe-partial-results-stability": input.PartialResultsStability,
89
+ "x-amzn-transcribe-content-identification-type": input.ContentIdentificationType,
90
+ "x-amzn-transcribe-content-redaction-type": input.ContentRedactionType,
91
+ "x-amzn-transcribe-pii-entity-types": input.PiiEntityTypes,
92
+ "x-amzn-transcribe-language-model-name": input.LanguageModelName,
93
+ "x-amzn-transcribe-identify-language": [
94
+ function () { return isSerializableHeaderValue(input.IdentifyLanguage); },
95
+ function () { return input.IdentifyLanguage.toString(); },
96
+ ],
97
+ "x-amzn-transcribe-language-options": input.LanguageOptions,
98
+ "x-amzn-transcribe-preferred-language": input.PreferredLanguage,
99
+ "x-amzn-transcribe-vocabulary-names": input.VocabularyNames,
100
+ "x-amzn-transcribe-vocabulary-filter-names": input.VocabularyFilterNames,
101
+ });
102
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/stream-transcription";
103
+ if (input.AudioStream !== undefined) {
104
+ body = serializeAws_restJson1AudioStream(input.AudioStream, context);
105
+ }
106
+ return [2, new __HttpRequest({
107
+ protocol: protocol,
108
+ hostname: hostname,
109
+ port: port,
110
+ method: "POST",
111
+ headers: headers,
112
+ path: resolvedPath,
113
+ body: body,
114
+ })];
115
+ }
89
116
  });
90
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/stream-transcription";
91
- let body;
92
- if (input.AudioStream !== undefined) {
93
- body = serializeAws_restJson1AudioStream(input.AudioStream, context);
94
- }
95
- return new __HttpRequest({
96
- protocol,
97
- hostname,
98
- port,
99
- method: "POST",
100
- headers,
101
- path: resolvedPath,
102
- body,
117
+ }); };
118
+ export var deserializeAws_restJson1StartMedicalStreamTranscriptionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
119
+ var contents, data;
120
+ return __generator(this, function (_a) {
121
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
122
+ return [2, deserializeAws_restJson1StartMedicalStreamTranscriptionCommandError(output, context)];
123
+ }
124
+ contents = map({
125
+ $metadata: deserializeMetadata(output),
126
+ RequestId: [, output.headers["x-amzn-request-id"]],
127
+ LanguageCode: [, output.headers["x-amzn-transcribe-language-code"]],
128
+ MediaSampleRateHertz: [
129
+ function () { return void 0 !== output.headers["x-amzn-transcribe-sample-rate"]; },
130
+ function () { return __strictParseInt32(output.headers["x-amzn-transcribe-sample-rate"]); },
131
+ ],
132
+ MediaEncoding: [, output.headers["x-amzn-transcribe-media-encoding"]],
133
+ VocabularyName: [, output.headers["x-amzn-transcribe-vocabulary-name"]],
134
+ Specialty: [, output.headers["x-amzn-transcribe-specialty"]],
135
+ Type: [, output.headers["x-amzn-transcribe-type"]],
136
+ ShowSpeakerLabel: [
137
+ function () { return void 0 !== output.headers["x-amzn-transcribe-show-speaker-label"]; },
138
+ function () { return __parseBoolean(output.headers["x-amzn-transcribe-show-speaker-label"]); },
139
+ ],
140
+ SessionId: [, output.headers["x-amzn-transcribe-session-id"]],
141
+ EnableChannelIdentification: [
142
+ function () { return void 0 !== output.headers["x-amzn-transcribe-enable-channel-identification"]; },
143
+ function () { return __parseBoolean(output.headers["x-amzn-transcribe-enable-channel-identification"]); },
144
+ ],
145
+ NumberOfChannels: [
146
+ function () { return void 0 !== output.headers["x-amzn-transcribe-number-of-channels"]; },
147
+ function () { return __strictParseInt32(output.headers["x-amzn-transcribe-number-of-channels"]); },
148
+ ],
149
+ ContentIdentificationType: [, output.headers["x-amzn-transcribe-content-identification-type"]],
150
+ });
151
+ data = output.body;
152
+ contents.TranscriptResultStream = deserializeAws_restJson1MedicalTranscriptResultStream(data, context);
153
+ return [2, contents];
103
154
  });
104
- };
105
- export const deserializeAws_restJson1StartMedicalStreamTranscriptionCommand = async (output, context) => {
106
- if (output.statusCode !== 200 && output.statusCode >= 300) {
107
- return deserializeAws_restJson1StartMedicalStreamTranscriptionCommandError(output, context);
108
- }
109
- const contents = map({
110
- $metadata: deserializeMetadata(output),
111
- RequestId: [, output.headers["x-amzn-request-id"]],
112
- LanguageCode: [, output.headers["x-amzn-transcribe-language-code"]],
113
- MediaSampleRateHertz: [
114
- () => void 0 !== output.headers["x-amzn-transcribe-sample-rate"],
115
- () => __strictParseInt32(output.headers["x-amzn-transcribe-sample-rate"]),
116
- ],
117
- MediaEncoding: [, output.headers["x-amzn-transcribe-media-encoding"]],
118
- VocabularyName: [, output.headers["x-amzn-transcribe-vocabulary-name"]],
119
- Specialty: [, output.headers["x-amzn-transcribe-specialty"]],
120
- Type: [, output.headers["x-amzn-transcribe-type"]],
121
- ShowSpeakerLabel: [
122
- () => void 0 !== output.headers["x-amzn-transcribe-show-speaker-label"],
123
- () => __parseBoolean(output.headers["x-amzn-transcribe-show-speaker-label"]),
124
- ],
125
- SessionId: [, output.headers["x-amzn-transcribe-session-id"]],
126
- EnableChannelIdentification: [
127
- () => void 0 !== output.headers["x-amzn-transcribe-enable-channel-identification"],
128
- () => __parseBoolean(output.headers["x-amzn-transcribe-enable-channel-identification"]),
129
- ],
130
- NumberOfChannels: [
131
- () => void 0 !== output.headers["x-amzn-transcribe-number-of-channels"],
132
- () => __strictParseInt32(output.headers["x-amzn-transcribe-number-of-channels"]),
133
- ],
134
- ContentIdentificationType: [, output.headers["x-amzn-transcribe-content-identification-type"]],
155
+ }); };
156
+ var deserializeAws_restJson1StartMedicalStreamTranscriptionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
157
+ var parsedOutput, _a, errorCode, _b, parsedBody;
158
+ var _c;
159
+ return __generator(this, function (_d) {
160
+ switch (_d.label) {
161
+ case 0:
162
+ _a = [__assign({}, output)];
163
+ _c = {};
164
+ return [4, parseErrorBody(output.body, context)];
165
+ case 1:
166
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
167
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
168
+ _b = errorCode;
169
+ switch (_b) {
170
+ case "BadRequestException": return [3, 2];
171
+ case "com.amazonaws.transcribestreaming#BadRequestException": return [3, 2];
172
+ case "ConflictException": return [3, 4];
173
+ case "com.amazonaws.transcribestreaming#ConflictException": return [3, 4];
174
+ case "InternalFailureException": return [3, 6];
175
+ case "com.amazonaws.transcribestreaming#InternalFailureException": return [3, 6];
176
+ case "LimitExceededException": return [3, 8];
177
+ case "com.amazonaws.transcribestreaming#LimitExceededException": return [3, 8];
178
+ case "ServiceUnavailableException": return [3, 10];
179
+ case "com.amazonaws.transcribestreaming#ServiceUnavailableException": return [3, 10];
180
+ }
181
+ return [3, 12];
182
+ case 2: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
183
+ case 3: throw _d.sent();
184
+ case 4: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
185
+ case 5: throw _d.sent();
186
+ case 6: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
187
+ case 7: throw _d.sent();
188
+ case 8: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
189
+ case 9: throw _d.sent();
190
+ case 10: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
191
+ case 11: throw _d.sent();
192
+ case 12:
193
+ parsedBody = parsedOutput.body;
194
+ throwDefaultError({
195
+ output: output,
196
+ parsedBody: parsedBody,
197
+ exceptionCtor: __BaseException,
198
+ errorCode: errorCode,
199
+ });
200
+ _d.label = 13;
201
+ case 13: return [2];
202
+ }
135
203
  });
136
- const data = output.body;
137
- contents.TranscriptResultStream = deserializeAws_restJson1MedicalTranscriptResultStream(data, context);
138
- return contents;
139
- };
140
- const deserializeAws_restJson1StartMedicalStreamTranscriptionCommandError = async (output, context) => {
141
- const parsedOutput = {
142
- ...output,
143
- body: await parseErrorBody(output.body, context),
144
- };
145
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
146
- switch (errorCode) {
147
- case "BadRequestException":
148
- case "com.amazonaws.transcribestreaming#BadRequestException":
149
- throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
150
- case "ConflictException":
151
- case "com.amazonaws.transcribestreaming#ConflictException":
152
- throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
153
- case "InternalFailureException":
154
- case "com.amazonaws.transcribestreaming#InternalFailureException":
155
- throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
156
- case "LimitExceededException":
157
- case "com.amazonaws.transcribestreaming#LimitExceededException":
158
- throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
159
- case "ServiceUnavailableException":
160
- case "com.amazonaws.transcribestreaming#ServiceUnavailableException":
161
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
162
- default:
163
- const parsedBody = parsedOutput.body;
164
- throwDefaultError({
165
- output,
166
- parsedBody,
167
- exceptionCtor: __BaseException,
168
- errorCode,
169
- });
170
- }
171
- };
172
- export const deserializeAws_restJson1StartStreamTranscriptionCommand = async (output, context) => {
173
- if (output.statusCode !== 200 && output.statusCode >= 300) {
174
- return deserializeAws_restJson1StartStreamTranscriptionCommandError(output, context);
175
- }
176
- const contents = map({
177
- $metadata: deserializeMetadata(output),
178
- RequestId: [, output.headers["x-amzn-request-id"]],
179
- LanguageCode: [, output.headers["x-amzn-transcribe-language-code"]],
180
- MediaSampleRateHertz: [
181
- () => void 0 !== output.headers["x-amzn-transcribe-sample-rate"],
182
- () => __strictParseInt32(output.headers["x-amzn-transcribe-sample-rate"]),
183
- ],
184
- MediaEncoding: [, output.headers["x-amzn-transcribe-media-encoding"]],
185
- VocabularyName: [, output.headers["x-amzn-transcribe-vocabulary-name"]],
186
- SessionId: [, output.headers["x-amzn-transcribe-session-id"]],
187
- VocabularyFilterName: [, output.headers["x-amzn-transcribe-vocabulary-filter-name"]],
188
- VocabularyFilterMethod: [, output.headers["x-amzn-transcribe-vocabulary-filter-method"]],
189
- ShowSpeakerLabel: [
190
- () => void 0 !== output.headers["x-amzn-transcribe-show-speaker-label"],
191
- () => __parseBoolean(output.headers["x-amzn-transcribe-show-speaker-label"]),
192
- ],
193
- EnableChannelIdentification: [
194
- () => void 0 !== output.headers["x-amzn-transcribe-enable-channel-identification"],
195
- () => __parseBoolean(output.headers["x-amzn-transcribe-enable-channel-identification"]),
196
- ],
197
- NumberOfChannels: [
198
- () => void 0 !== output.headers["x-amzn-transcribe-number-of-channels"],
199
- () => __strictParseInt32(output.headers["x-amzn-transcribe-number-of-channels"]),
200
- ],
201
- EnablePartialResultsStabilization: [
202
- () => void 0 !== output.headers["x-amzn-transcribe-enable-partial-results-stabilization"],
203
- () => __parseBoolean(output.headers["x-amzn-transcribe-enable-partial-results-stabilization"]),
204
- ],
205
- PartialResultsStability: [, output.headers["x-amzn-transcribe-partial-results-stability"]],
206
- ContentIdentificationType: [, output.headers["x-amzn-transcribe-content-identification-type"]],
207
- ContentRedactionType: [, output.headers["x-amzn-transcribe-content-redaction-type"]],
208
- PiiEntityTypes: [, output.headers["x-amzn-transcribe-pii-entity-types"]],
209
- LanguageModelName: [, output.headers["x-amzn-transcribe-language-model-name"]],
210
- IdentifyLanguage: [
211
- () => void 0 !== output.headers["x-amzn-transcribe-identify-language"],
212
- () => __parseBoolean(output.headers["x-amzn-transcribe-identify-language"]),
213
- ],
214
- LanguageOptions: [, output.headers["x-amzn-transcribe-language-options"]],
215
- PreferredLanguage: [, output.headers["x-amzn-transcribe-preferred-language"]],
216
- VocabularyNames: [, output.headers["x-amzn-transcribe-vocabulary-names"]],
217
- VocabularyFilterNames: [, output.headers["x-amzn-transcribe-vocabulary-filter-names"]],
204
+ }); };
205
+ export var deserializeAws_restJson1StartStreamTranscriptionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
206
+ var contents, data;
207
+ return __generator(this, function (_a) {
208
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
209
+ return [2, deserializeAws_restJson1StartStreamTranscriptionCommandError(output, context)];
210
+ }
211
+ contents = map({
212
+ $metadata: deserializeMetadata(output),
213
+ RequestId: [, output.headers["x-amzn-request-id"]],
214
+ LanguageCode: [, output.headers["x-amzn-transcribe-language-code"]],
215
+ MediaSampleRateHertz: [
216
+ function () { return void 0 !== output.headers["x-amzn-transcribe-sample-rate"]; },
217
+ function () { return __strictParseInt32(output.headers["x-amzn-transcribe-sample-rate"]); },
218
+ ],
219
+ MediaEncoding: [, output.headers["x-amzn-transcribe-media-encoding"]],
220
+ VocabularyName: [, output.headers["x-amzn-transcribe-vocabulary-name"]],
221
+ SessionId: [, output.headers["x-amzn-transcribe-session-id"]],
222
+ VocabularyFilterName: [, output.headers["x-amzn-transcribe-vocabulary-filter-name"]],
223
+ VocabularyFilterMethod: [, output.headers["x-amzn-transcribe-vocabulary-filter-method"]],
224
+ ShowSpeakerLabel: [
225
+ function () { return void 0 !== output.headers["x-amzn-transcribe-show-speaker-label"]; },
226
+ function () { return __parseBoolean(output.headers["x-amzn-transcribe-show-speaker-label"]); },
227
+ ],
228
+ EnableChannelIdentification: [
229
+ function () { return void 0 !== output.headers["x-amzn-transcribe-enable-channel-identification"]; },
230
+ function () { return __parseBoolean(output.headers["x-amzn-transcribe-enable-channel-identification"]); },
231
+ ],
232
+ NumberOfChannels: [
233
+ function () { return void 0 !== output.headers["x-amzn-transcribe-number-of-channels"]; },
234
+ function () { return __strictParseInt32(output.headers["x-amzn-transcribe-number-of-channels"]); },
235
+ ],
236
+ EnablePartialResultsStabilization: [
237
+ function () { return void 0 !== output.headers["x-amzn-transcribe-enable-partial-results-stabilization"]; },
238
+ function () { return __parseBoolean(output.headers["x-amzn-transcribe-enable-partial-results-stabilization"]); },
239
+ ],
240
+ PartialResultsStability: [, output.headers["x-amzn-transcribe-partial-results-stability"]],
241
+ ContentIdentificationType: [, output.headers["x-amzn-transcribe-content-identification-type"]],
242
+ ContentRedactionType: [, output.headers["x-amzn-transcribe-content-redaction-type"]],
243
+ PiiEntityTypes: [, output.headers["x-amzn-transcribe-pii-entity-types"]],
244
+ LanguageModelName: [, output.headers["x-amzn-transcribe-language-model-name"]],
245
+ IdentifyLanguage: [
246
+ function () { return void 0 !== output.headers["x-amzn-transcribe-identify-language"]; },
247
+ function () { return __parseBoolean(output.headers["x-amzn-transcribe-identify-language"]); },
248
+ ],
249
+ LanguageOptions: [, output.headers["x-amzn-transcribe-language-options"]],
250
+ PreferredLanguage: [, output.headers["x-amzn-transcribe-preferred-language"]],
251
+ VocabularyNames: [, output.headers["x-amzn-transcribe-vocabulary-names"]],
252
+ VocabularyFilterNames: [, output.headers["x-amzn-transcribe-vocabulary-filter-names"]],
253
+ });
254
+ data = output.body;
255
+ contents.TranscriptResultStream = deserializeAws_restJson1TranscriptResultStream(data, context);
256
+ return [2, contents];
218
257
  });
219
- const data = output.body;
220
- contents.TranscriptResultStream = deserializeAws_restJson1TranscriptResultStream(data, context);
221
- return contents;
222
- };
223
- const deserializeAws_restJson1StartStreamTranscriptionCommandError = async (output, context) => {
224
- const parsedOutput = {
225
- ...output,
226
- body: await parseErrorBody(output.body, context),
227
- };
228
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
229
- switch (errorCode) {
230
- case "BadRequestException":
231
- case "com.amazonaws.transcribestreaming#BadRequestException":
232
- throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
233
- case "ConflictException":
234
- case "com.amazonaws.transcribestreaming#ConflictException":
235
- throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
236
- case "InternalFailureException":
237
- case "com.amazonaws.transcribestreaming#InternalFailureException":
238
- throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
239
- case "LimitExceededException":
240
- case "com.amazonaws.transcribestreaming#LimitExceededException":
241
- throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
242
- case "ServiceUnavailableException":
243
- case "com.amazonaws.transcribestreaming#ServiceUnavailableException":
244
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
245
- default:
246
- const parsedBody = parsedOutput.body;
247
- throwDefaultError({
248
- output,
249
- parsedBody,
250
- exceptionCtor: __BaseException,
251
- errorCode,
252
- });
253
- }
254
- };
255
- const map = __map;
256
- const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
257
- const contents = map({});
258
- const data = parsedOutput.body;
259
- if (data.Message != null) {
260
- contents.Message = __expectString(data.Message);
261
- }
262
- const exception = new BadRequestException({
263
- $metadata: deserializeMetadata(parsedOutput),
264
- ...contents,
258
+ }); };
259
+ var deserializeAws_restJson1StartStreamTranscriptionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
260
+ var parsedOutput, _a, errorCode, _b, parsedBody;
261
+ var _c;
262
+ return __generator(this, function (_d) {
263
+ switch (_d.label) {
264
+ case 0:
265
+ _a = [__assign({}, output)];
266
+ _c = {};
267
+ return [4, parseErrorBody(output.body, context)];
268
+ case 1:
269
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
270
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
271
+ _b = errorCode;
272
+ switch (_b) {
273
+ case "BadRequestException": return [3, 2];
274
+ case "com.amazonaws.transcribestreaming#BadRequestException": return [3, 2];
275
+ case "ConflictException": return [3, 4];
276
+ case "com.amazonaws.transcribestreaming#ConflictException": return [3, 4];
277
+ case "InternalFailureException": return [3, 6];
278
+ case "com.amazonaws.transcribestreaming#InternalFailureException": return [3, 6];
279
+ case "LimitExceededException": return [3, 8];
280
+ case "com.amazonaws.transcribestreaming#LimitExceededException": return [3, 8];
281
+ case "ServiceUnavailableException": return [3, 10];
282
+ case "com.amazonaws.transcribestreaming#ServiceUnavailableException": return [3, 10];
283
+ }
284
+ return [3, 12];
285
+ case 2: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
286
+ case 3: throw _d.sent();
287
+ case 4: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
288
+ case 5: throw _d.sent();
289
+ case 6: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
290
+ case 7: throw _d.sent();
291
+ case 8: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
292
+ case 9: throw _d.sent();
293
+ case 10: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
294
+ case 11: throw _d.sent();
295
+ case 12:
296
+ parsedBody = parsedOutput.body;
297
+ throwDefaultError({
298
+ output: output,
299
+ parsedBody: parsedBody,
300
+ exceptionCtor: __BaseException,
301
+ errorCode: errorCode,
302
+ });
303
+ _d.label = 13;
304
+ case 13: return [2];
305
+ }
265
306
  });
266
- return __decorateServiceException(exception, parsedOutput.body);
267
- };
268
- const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
269
- const contents = map({});
270
- const data = parsedOutput.body;
271
- if (data.Message != null) {
272
- contents.Message = __expectString(data.Message);
273
- }
274
- const exception = new ConflictException({
275
- $metadata: deserializeMetadata(parsedOutput),
276
- ...contents,
307
+ }); };
308
+ var map = __map;
309
+ var deserializeAws_restJson1BadRequestExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
310
+ var contents, data, exception;
311
+ return __generator(this, function (_a) {
312
+ contents = map({});
313
+ data = parsedOutput.body;
314
+ if (data.Message != null) {
315
+ contents.Message = __expectString(data.Message);
316
+ }
317
+ exception = new BadRequestException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
318
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
277
319
  });
278
- return __decorateServiceException(exception, parsedOutput.body);
279
- };
280
- const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
281
- const contents = map({});
282
- const data = parsedOutput.body;
283
- if (data.Message != null) {
284
- contents.Message = __expectString(data.Message);
285
- }
286
- const exception = new InternalFailureException({
287
- $metadata: deserializeMetadata(parsedOutput),
288
- ...contents,
320
+ }); };
321
+ var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
322
+ var contents, data, exception;
323
+ return __generator(this, function (_a) {
324
+ contents = map({});
325
+ data = parsedOutput.body;
326
+ if (data.Message != null) {
327
+ contents.Message = __expectString(data.Message);
328
+ }
329
+ exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
330
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
289
331
  });
290
- return __decorateServiceException(exception, parsedOutput.body);
291
- };
292
- const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
293
- const contents = map({});
294
- const data = parsedOutput.body;
295
- if (data.Message != null) {
296
- contents.Message = __expectString(data.Message);
297
- }
298
- const exception = new LimitExceededException({
299
- $metadata: deserializeMetadata(parsedOutput),
300
- ...contents,
332
+ }); };
333
+ var deserializeAws_restJson1InternalFailureExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
334
+ var contents, data, exception;
335
+ return __generator(this, function (_a) {
336
+ contents = map({});
337
+ data = parsedOutput.body;
338
+ if (data.Message != null) {
339
+ contents.Message = __expectString(data.Message);
340
+ }
341
+ exception = new InternalFailureException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
342
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
301
343
  });
302
- return __decorateServiceException(exception, parsedOutput.body);
303
- };
304
- const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
305
- const contents = map({});
306
- const data = parsedOutput.body;
307
- if (data.Message != null) {
308
- contents.Message = __expectString(data.Message);
309
- }
310
- const exception = new ServiceUnavailableException({
311
- $metadata: deserializeMetadata(parsedOutput),
312
- ...contents,
344
+ }); };
345
+ var deserializeAws_restJson1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
346
+ var contents, data, exception;
347
+ return __generator(this, function (_a) {
348
+ contents = map({});
349
+ data = parsedOutput.body;
350
+ if (data.Message != null) {
351
+ contents.Message = __expectString(data.Message);
352
+ }
353
+ exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
354
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
313
355
  });
314
- return __decorateServiceException(exception, parsedOutput.body);
315
- };
316
- const serializeAws_restJson1AudioStream = (input, context) => {
317
- const eventMarshallingVisitor = (event) => AudioStream.visit(event, {
318
- AudioEvent: (value) => serializeAws_restJson1AudioEvent_event(value, context),
319
- _: (value) => value,
356
+ }); };
357
+ var deserializeAws_restJson1ServiceUnavailableExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
358
+ var contents, data, exception;
359
+ return __generator(this, function (_a) {
360
+ contents = map({});
361
+ data = parsedOutput.body;
362
+ if (data.Message != null) {
363
+ contents.Message = __expectString(data.Message);
364
+ }
365
+ exception = new ServiceUnavailableException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
366
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
320
367
  });
368
+ }); };
369
+ var serializeAws_restJson1AudioStream = function (input, context) {
370
+ var eventMarshallingVisitor = function (event) {
371
+ return AudioStream.visit(event, {
372
+ AudioEvent: function (value) { return serializeAws_restJson1AudioEvent_event(value, context); },
373
+ _: function (value) { return value; },
374
+ });
375
+ };
321
376
  return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
322
377
  };
323
- const serializeAws_restJson1AudioEvent_event = (input, context) => {
324
- const headers = {
378
+ var serializeAws_restJson1AudioEvent_event = function (input, context) {
379
+ var headers = {
325
380
  ":event-type": { type: "string", value: "AudioEvent" },
326
381
  ":message-type": { type: "string", value: "event" },
327
382
  ":content-type": { type: "string", value: "application/octet-stream" },
328
383
  };
329
- let body = new Uint8Array();
384
+ var body = new Uint8Array();
330
385
  if (input.AudioChunk != null) {
331
386
  body = input.AudioChunk;
332
387
  }
333
- return { headers, body };
334
- };
335
- const deserializeAws_restJson1MedicalTranscriptResultStream = (output, context) => {
336
- return context.eventStreamMarshaller.deserialize(output, async (event) => {
337
- if (event["TranscriptEvent"] != null) {
338
- return {
339
- TranscriptEvent: await deserializeAws_restJson1MedicalTranscriptEvent_event(event["TranscriptEvent"], context),
340
- };
341
- }
342
- if (event["BadRequestException"] != null) {
343
- return {
344
- BadRequestException: await deserializeAws_restJson1BadRequestException_event(event["BadRequestException"], context),
345
- };
346
- }
347
- if (event["LimitExceededException"] != null) {
348
- return {
349
- LimitExceededException: await deserializeAws_restJson1LimitExceededException_event(event["LimitExceededException"], context),
350
- };
351
- }
352
- if (event["InternalFailureException"] != null) {
353
- return {
354
- InternalFailureException: await deserializeAws_restJson1InternalFailureException_event(event["InternalFailureException"], context),
355
- };
356
- }
357
- if (event["ConflictException"] != null) {
358
- return {
359
- ConflictException: await deserializeAws_restJson1ConflictException_event(event["ConflictException"], context),
360
- };
361
- }
362
- if (event["ServiceUnavailableException"] != null) {
363
- return {
364
- ServiceUnavailableException: await deserializeAws_restJson1ServiceUnavailableException_event(event["ServiceUnavailableException"], context),
365
- };
366
- }
367
- return { $unknown: output };
388
+ return { headers: headers, body: body };
389
+ };
390
+ var deserializeAws_restJson1MedicalTranscriptResultStream = function (output, context) {
391
+ return context.eventStreamMarshaller.deserialize(output, function (event) { return __awaiter(void 0, void 0, void 0, function () {
392
+ var _a, _b, _c, _d, _e, _f;
393
+ return __generator(this, function (_g) {
394
+ switch (_g.label) {
395
+ case 0:
396
+ if (!(event["TranscriptEvent"] != null)) return [3, 2];
397
+ _a = {};
398
+ return [4, deserializeAws_restJson1MedicalTranscriptEvent_event(event["TranscriptEvent"], context)];
399
+ case 1: return [2, (_a.TranscriptEvent = _g.sent(),
400
+ _a)];
401
+ case 2:
402
+ if (!(event["BadRequestException"] != null)) return [3, 4];
403
+ _b = {};
404
+ return [4, deserializeAws_restJson1BadRequestException_event(event["BadRequestException"], context)];
405
+ case 3: return [2, (_b.BadRequestException = _g.sent(),
406
+ _b)];
407
+ case 4:
408
+ if (!(event["LimitExceededException"] != null)) return [3, 6];
409
+ _c = {};
410
+ return [4, deserializeAws_restJson1LimitExceededException_event(event["LimitExceededException"], context)];
411
+ case 5: return [2, (_c.LimitExceededException = _g.sent(),
412
+ _c)];
413
+ case 6:
414
+ if (!(event["InternalFailureException"] != null)) return [3, 8];
415
+ _d = {};
416
+ return [4, deserializeAws_restJson1InternalFailureException_event(event["InternalFailureException"], context)];
417
+ case 7: return [2, (_d.InternalFailureException = _g.sent(),
418
+ _d)];
419
+ case 8:
420
+ if (!(event["ConflictException"] != null)) return [3, 10];
421
+ _e = {};
422
+ return [4, deserializeAws_restJson1ConflictException_event(event["ConflictException"], context)];
423
+ case 9: return [2, (_e.ConflictException = _g.sent(),
424
+ _e)];
425
+ case 10:
426
+ if (!(event["ServiceUnavailableException"] != null)) return [3, 12];
427
+ _f = {};
428
+ return [4, deserializeAws_restJson1ServiceUnavailableException_event(event["ServiceUnavailableException"], context)];
429
+ case 11: return [2, (_f.ServiceUnavailableException = _g.sent(),
430
+ _f)];
431
+ case 12: return [2, { $unknown: output }];
432
+ }
433
+ });
434
+ }); });
435
+ };
436
+ var deserializeAws_restJson1TranscriptResultStream = function (output, context) {
437
+ return context.eventStreamMarshaller.deserialize(output, function (event) { return __awaiter(void 0, void 0, void 0, function () {
438
+ var _a, _b, _c, _d, _e, _f;
439
+ return __generator(this, function (_g) {
440
+ switch (_g.label) {
441
+ case 0:
442
+ if (!(event["TranscriptEvent"] != null)) return [3, 2];
443
+ _a = {};
444
+ return [4, deserializeAws_restJson1TranscriptEvent_event(event["TranscriptEvent"], context)];
445
+ case 1: return [2, (_a.TranscriptEvent = _g.sent(),
446
+ _a)];
447
+ case 2:
448
+ if (!(event["BadRequestException"] != null)) return [3, 4];
449
+ _b = {};
450
+ return [4, deserializeAws_restJson1BadRequestException_event(event["BadRequestException"], context)];
451
+ case 3: return [2, (_b.BadRequestException = _g.sent(),
452
+ _b)];
453
+ case 4:
454
+ if (!(event["LimitExceededException"] != null)) return [3, 6];
455
+ _c = {};
456
+ return [4, deserializeAws_restJson1LimitExceededException_event(event["LimitExceededException"], context)];
457
+ case 5: return [2, (_c.LimitExceededException = _g.sent(),
458
+ _c)];
459
+ case 6:
460
+ if (!(event["InternalFailureException"] != null)) return [3, 8];
461
+ _d = {};
462
+ return [4, deserializeAws_restJson1InternalFailureException_event(event["InternalFailureException"], context)];
463
+ case 7: return [2, (_d.InternalFailureException = _g.sent(),
464
+ _d)];
465
+ case 8:
466
+ if (!(event["ConflictException"] != null)) return [3, 10];
467
+ _e = {};
468
+ return [4, deserializeAws_restJson1ConflictException_event(event["ConflictException"], context)];
469
+ case 9: return [2, (_e.ConflictException = _g.sent(),
470
+ _e)];
471
+ case 10:
472
+ if (!(event["ServiceUnavailableException"] != null)) return [3, 12];
473
+ _f = {};
474
+ return [4, deserializeAws_restJson1ServiceUnavailableException_event(event["ServiceUnavailableException"], context)];
475
+ case 11: return [2, (_f.ServiceUnavailableException = _g.sent(),
476
+ _f)];
477
+ case 12: return [2, { $unknown: output }];
478
+ }
479
+ });
480
+ }); });
481
+ };
482
+ var deserializeAws_restJson1BadRequestException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
483
+ var parsedOutput, _a;
484
+ var _b;
485
+ return __generator(this, function (_c) {
486
+ switch (_c.label) {
487
+ case 0:
488
+ _a = [__assign({}, output)];
489
+ _b = {};
490
+ return [4, parseBody(output.body, context)];
491
+ case 1:
492
+ parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
493
+ return [2, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
494
+ }
368
495
  });
369
- };
370
- const deserializeAws_restJson1TranscriptResultStream = (output, context) => {
371
- return context.eventStreamMarshaller.deserialize(output, async (event) => {
372
- if (event["TranscriptEvent"] != null) {
373
- return {
374
- TranscriptEvent: await deserializeAws_restJson1TranscriptEvent_event(event["TranscriptEvent"], context),
375
- };
376
- }
377
- if (event["BadRequestException"] != null) {
378
- return {
379
- BadRequestException: await deserializeAws_restJson1BadRequestException_event(event["BadRequestException"], context),
380
- };
381
- }
382
- if (event["LimitExceededException"] != null) {
383
- return {
384
- LimitExceededException: await deserializeAws_restJson1LimitExceededException_event(event["LimitExceededException"], context),
385
- };
386
- }
387
- if (event["InternalFailureException"] != null) {
388
- return {
389
- InternalFailureException: await deserializeAws_restJson1InternalFailureException_event(event["InternalFailureException"], context),
390
- };
391
- }
392
- if (event["ConflictException"] != null) {
393
- return {
394
- ConflictException: await deserializeAws_restJson1ConflictException_event(event["ConflictException"], context),
395
- };
396
- }
397
- if (event["ServiceUnavailableException"] != null) {
398
- return {
399
- ServiceUnavailableException: await deserializeAws_restJson1ServiceUnavailableException_event(event["ServiceUnavailableException"], context),
400
- };
401
- }
402
- return { $unknown: output };
496
+ }); };
497
+ var deserializeAws_restJson1ConflictException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
498
+ var parsedOutput, _a;
499
+ var _b;
500
+ return __generator(this, function (_c) {
501
+ switch (_c.label) {
502
+ case 0:
503
+ _a = [__assign({}, output)];
504
+ _b = {};
505
+ return [4, parseBody(output.body, context)];
506
+ case 1:
507
+ parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
508
+ return [2, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
509
+ }
403
510
  });
404
- };
405
- const deserializeAws_restJson1BadRequestException_event = async (output, context) => {
406
- const parsedOutput = {
407
- ...output,
408
- body: await parseBody(output.body, context),
409
- };
410
- return deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
411
- };
412
- const deserializeAws_restJson1ConflictException_event = async (output, context) => {
413
- const parsedOutput = {
414
- ...output,
415
- body: await parseBody(output.body, context),
416
- };
417
- return deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
418
- };
419
- const deserializeAws_restJson1InternalFailureException_event = async (output, context) => {
420
- const parsedOutput = {
421
- ...output,
422
- body: await parseBody(output.body, context),
423
- };
424
- return deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
425
- };
426
- const deserializeAws_restJson1LimitExceededException_event = async (output, context) => {
427
- const parsedOutput = {
428
- ...output,
429
- body: await parseBody(output.body, context),
430
- };
431
- return deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
432
- };
433
- const deserializeAws_restJson1MedicalTranscriptEvent_event = async (output, context) => {
434
- const contents = {};
435
- const data = await parseBody(output.body, context);
436
- Object.assign(contents, deserializeAws_restJson1MedicalTranscriptEvent(data, context));
437
- return contents;
438
- };
439
- const deserializeAws_restJson1ServiceUnavailableException_event = async (output, context) => {
440
- const parsedOutput = {
441
- ...output,
442
- body: await parseBody(output.body, context),
443
- };
444
- return deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
445
- };
446
- const deserializeAws_restJson1TranscriptEvent_event = async (output, context) => {
447
- const contents = {};
448
- const data = await parseBody(output.body, context);
449
- Object.assign(contents, deserializeAws_restJson1TranscriptEvent(data, context));
450
- return contents;
451
- };
452
- const deserializeAws_restJson1Alternative = (output, context) => {
511
+ }); };
512
+ var deserializeAws_restJson1InternalFailureException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
513
+ var parsedOutput, _a;
514
+ var _b;
515
+ return __generator(this, function (_c) {
516
+ switch (_c.label) {
517
+ case 0:
518
+ _a = [__assign({}, output)];
519
+ _b = {};
520
+ return [4, parseBody(output.body, context)];
521
+ case 1:
522
+ parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
523
+ return [2, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
524
+ }
525
+ });
526
+ }); };
527
+ var deserializeAws_restJson1LimitExceededException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
528
+ var parsedOutput, _a;
529
+ var _b;
530
+ return __generator(this, function (_c) {
531
+ switch (_c.label) {
532
+ case 0:
533
+ _a = [__assign({}, output)];
534
+ _b = {};
535
+ return [4, parseBody(output.body, context)];
536
+ case 1:
537
+ parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
538
+ return [2, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
539
+ }
540
+ });
541
+ }); };
542
+ var deserializeAws_restJson1MedicalTranscriptEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
543
+ var contents, data;
544
+ return __generator(this, function (_a) {
545
+ switch (_a.label) {
546
+ case 0:
547
+ contents = {};
548
+ return [4, parseBody(output.body, context)];
549
+ case 1:
550
+ data = _a.sent();
551
+ Object.assign(contents, deserializeAws_restJson1MedicalTranscriptEvent(data, context));
552
+ return [2, contents];
553
+ }
554
+ });
555
+ }); };
556
+ var deserializeAws_restJson1ServiceUnavailableException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
557
+ var parsedOutput, _a;
558
+ var _b;
559
+ return __generator(this, function (_c) {
560
+ switch (_c.label) {
561
+ case 0:
562
+ _a = [__assign({}, output)];
563
+ _b = {};
564
+ return [4, parseBody(output.body, context)];
565
+ case 1:
566
+ parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
567
+ return [2, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
568
+ }
569
+ });
570
+ }); };
571
+ var deserializeAws_restJson1TranscriptEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
572
+ var contents, data;
573
+ return __generator(this, function (_a) {
574
+ switch (_a.label) {
575
+ case 0:
576
+ contents = {};
577
+ return [4, parseBody(output.body, context)];
578
+ case 1:
579
+ data = _a.sent();
580
+ Object.assign(contents, deserializeAws_restJson1TranscriptEvent(data, context));
581
+ return [2, contents];
582
+ }
583
+ });
584
+ }); };
585
+ var deserializeAws_restJson1Alternative = function (output, context) {
453
586
  return {
454
587
  Entities: output.Entities != null ? deserializeAws_restJson1EntityList(output.Entities, context) : undefined,
455
588
  Items: output.Items != null ? deserializeAws_restJson1ItemList(output.Items, context) : undefined,
456
589
  Transcript: __expectString(output.Transcript),
457
590
  };
458
591
  };
459
- const deserializeAws_restJson1AlternativeList = (output, context) => {
460
- const retVal = (output || [])
461
- .filter((e) => e != null)
462
- .map((entry) => {
592
+ var deserializeAws_restJson1AlternativeList = function (output, context) {
593
+ var retVal = (output || [])
594
+ .filter(function (e) { return e != null; })
595
+ .map(function (entry) {
463
596
  if (entry === null) {
464
597
  return null;
465
598
  }
@@ -467,7 +600,7 @@ const deserializeAws_restJson1AlternativeList = (output, context) => {
467
600
  });
468
601
  return retVal;
469
602
  };
470
- const deserializeAws_restJson1Entity = (output, context) => {
603
+ var deserializeAws_restJson1Entity = function (output, context) {
471
604
  return {
472
605
  Category: __expectString(output.Category),
473
606
  Confidence: __limitedParseDouble(output.Confidence),
@@ -477,10 +610,10 @@ const deserializeAws_restJson1Entity = (output, context) => {
477
610
  Type: __expectString(output.Type),
478
611
  };
479
612
  };
480
- const deserializeAws_restJson1EntityList = (output, context) => {
481
- const retVal = (output || [])
482
- .filter((e) => e != null)
483
- .map((entry) => {
613
+ var deserializeAws_restJson1EntityList = function (output, context) {
614
+ var retVal = (output || [])
615
+ .filter(function (e) { return e != null; })
616
+ .map(function (entry) {
484
617
  if (entry === null) {
485
618
  return null;
486
619
  }
@@ -488,7 +621,7 @@ const deserializeAws_restJson1EntityList = (output, context) => {
488
621
  });
489
622
  return retVal;
490
623
  };
491
- const deserializeAws_restJson1Item = (output, context) => {
624
+ var deserializeAws_restJson1Item = function (output, context) {
492
625
  return {
493
626
  Confidence: __limitedParseDouble(output.Confidence),
494
627
  Content: __expectString(output.Content),
@@ -500,10 +633,10 @@ const deserializeAws_restJson1Item = (output, context) => {
500
633
  VocabularyFilterMatch: __expectBoolean(output.VocabularyFilterMatch),
501
634
  };
502
635
  };
503
- const deserializeAws_restJson1ItemList = (output, context) => {
504
- const retVal = (output || [])
505
- .filter((e) => e != null)
506
- .map((entry) => {
636
+ var deserializeAws_restJson1ItemList = function (output, context) {
637
+ var retVal = (output || [])
638
+ .filter(function (e) { return e != null; })
639
+ .map(function (entry) {
507
640
  if (entry === null) {
508
641
  return null;
509
642
  }
@@ -511,10 +644,10 @@ const deserializeAws_restJson1ItemList = (output, context) => {
511
644
  });
512
645
  return retVal;
513
646
  };
514
- const deserializeAws_restJson1LanguageIdentification = (output, context) => {
515
- const retVal = (output || [])
516
- .filter((e) => e != null)
517
- .map((entry) => {
647
+ var deserializeAws_restJson1LanguageIdentification = function (output, context) {
648
+ var retVal = (output || [])
649
+ .filter(function (e) { return e != null; })
650
+ .map(function (entry) {
518
651
  if (entry === null) {
519
652
  return null;
520
653
  }
@@ -522,23 +655,23 @@ const deserializeAws_restJson1LanguageIdentification = (output, context) => {
522
655
  });
523
656
  return retVal;
524
657
  };
525
- const deserializeAws_restJson1LanguageWithScore = (output, context) => {
658
+ var deserializeAws_restJson1LanguageWithScore = function (output, context) {
526
659
  return {
527
660
  LanguageCode: __expectString(output.LanguageCode),
528
661
  Score: __limitedParseDouble(output.Score),
529
662
  };
530
663
  };
531
- const deserializeAws_restJson1MedicalAlternative = (output, context) => {
664
+ var deserializeAws_restJson1MedicalAlternative = function (output, context) {
532
665
  return {
533
666
  Entities: output.Entities != null ? deserializeAws_restJson1MedicalEntityList(output.Entities, context) : undefined,
534
667
  Items: output.Items != null ? deserializeAws_restJson1MedicalItemList(output.Items, context) : undefined,
535
668
  Transcript: __expectString(output.Transcript),
536
669
  };
537
670
  };
538
- const deserializeAws_restJson1MedicalAlternativeList = (output, context) => {
539
- const retVal = (output || [])
540
- .filter((e) => e != null)
541
- .map((entry) => {
671
+ var deserializeAws_restJson1MedicalAlternativeList = function (output, context) {
672
+ var retVal = (output || [])
673
+ .filter(function (e) { return e != null; })
674
+ .map(function (entry) {
542
675
  if (entry === null) {
543
676
  return null;
544
677
  }
@@ -546,7 +679,7 @@ const deserializeAws_restJson1MedicalAlternativeList = (output, context) => {
546
679
  });
547
680
  return retVal;
548
681
  };
549
- const deserializeAws_restJson1MedicalEntity = (output, context) => {
682
+ var deserializeAws_restJson1MedicalEntity = function (output, context) {
550
683
  return {
551
684
  Category: __expectString(output.Category),
552
685
  Confidence: __limitedParseDouble(output.Confidence),
@@ -555,10 +688,10 @@ const deserializeAws_restJson1MedicalEntity = (output, context) => {
555
688
  StartTime: __limitedParseDouble(output.StartTime),
556
689
  };
557
690
  };
558
- const deserializeAws_restJson1MedicalEntityList = (output, context) => {
559
- const retVal = (output || [])
560
- .filter((e) => e != null)
561
- .map((entry) => {
691
+ var deserializeAws_restJson1MedicalEntityList = function (output, context) {
692
+ var retVal = (output || [])
693
+ .filter(function (e) { return e != null; })
694
+ .map(function (entry) {
562
695
  if (entry === null) {
563
696
  return null;
564
697
  }
@@ -566,7 +699,7 @@ const deserializeAws_restJson1MedicalEntityList = (output, context) => {
566
699
  });
567
700
  return retVal;
568
701
  };
569
- const deserializeAws_restJson1MedicalItem = (output, context) => {
702
+ var deserializeAws_restJson1MedicalItem = function (output, context) {
570
703
  return {
571
704
  Confidence: __limitedParseDouble(output.Confidence),
572
705
  Content: __expectString(output.Content),
@@ -576,10 +709,10 @@ const deserializeAws_restJson1MedicalItem = (output, context) => {
576
709
  Type: __expectString(output.Type),
577
710
  };
578
711
  };
579
- const deserializeAws_restJson1MedicalItemList = (output, context) => {
580
- const retVal = (output || [])
581
- .filter((e) => e != null)
582
- .map((entry) => {
712
+ var deserializeAws_restJson1MedicalItemList = function (output, context) {
713
+ var retVal = (output || [])
714
+ .filter(function (e) { return e != null; })
715
+ .map(function (entry) {
583
716
  if (entry === null) {
584
717
  return null;
585
718
  }
@@ -587,7 +720,7 @@ const deserializeAws_restJson1MedicalItemList = (output, context) => {
587
720
  });
588
721
  return retVal;
589
722
  };
590
- const deserializeAws_restJson1MedicalResult = (output, context) => {
723
+ var deserializeAws_restJson1MedicalResult = function (output, context) {
591
724
  return {
592
725
  Alternatives: output.Alternatives != null
593
726
  ? deserializeAws_restJson1MedicalAlternativeList(output.Alternatives, context)
@@ -599,10 +732,10 @@ const deserializeAws_restJson1MedicalResult = (output, context) => {
599
732
  StartTime: __limitedParseDouble(output.StartTime),
600
733
  };
601
734
  };
602
- const deserializeAws_restJson1MedicalResultList = (output, context) => {
603
- const retVal = (output || [])
604
- .filter((e) => e != null)
605
- .map((entry) => {
735
+ var deserializeAws_restJson1MedicalResultList = function (output, context) {
736
+ var retVal = (output || [])
737
+ .filter(function (e) { return e != null; })
738
+ .map(function (entry) {
606
739
  if (entry === null) {
607
740
  return null;
608
741
  }
@@ -610,17 +743,17 @@ const deserializeAws_restJson1MedicalResultList = (output, context) => {
610
743
  });
611
744
  return retVal;
612
745
  };
613
- const deserializeAws_restJson1MedicalTranscript = (output, context) => {
746
+ var deserializeAws_restJson1MedicalTranscript = function (output, context) {
614
747
  return {
615
748
  Results: output.Results != null ? deserializeAws_restJson1MedicalResultList(output.Results, context) : undefined,
616
749
  };
617
750
  };
618
- const deserializeAws_restJson1MedicalTranscriptEvent = (output, context) => {
751
+ var deserializeAws_restJson1MedicalTranscriptEvent = function (output, context) {
619
752
  return {
620
753
  Transcript: output.Transcript != null ? deserializeAws_restJson1MedicalTranscript(output.Transcript, context) : undefined,
621
754
  };
622
755
  };
623
- const deserializeAws_restJson1Result = (output, context) => {
756
+ var deserializeAws_restJson1Result = function (output, context) {
624
757
  return {
625
758
  Alternatives: output.Alternatives != null ? deserializeAws_restJson1AlternativeList(output.Alternatives, context) : undefined,
626
759
  ChannelId: __expectString(output.ChannelId),
@@ -634,10 +767,10 @@ const deserializeAws_restJson1Result = (output, context) => {
634
767
  StartTime: __limitedParseDouble(output.StartTime),
635
768
  };
636
769
  };
637
- const deserializeAws_restJson1ResultList = (output, context) => {
638
- const retVal = (output || [])
639
- .filter((e) => e != null)
640
- .map((entry) => {
770
+ var deserializeAws_restJson1ResultList = function (output, context) {
771
+ var retVal = (output || [])
772
+ .filter(function (e) { return e != null; })
773
+ .map(function (entry) {
641
774
  if (entry === null) {
642
775
  return null;
643
776
  }
@@ -645,49 +778,67 @@ const deserializeAws_restJson1ResultList = (output, context) => {
645
778
  });
646
779
  return retVal;
647
780
  };
648
- const deserializeAws_restJson1Transcript = (output, context) => {
781
+ var deserializeAws_restJson1Transcript = function (output, context) {
649
782
  return {
650
783
  Results: output.Results != null ? deserializeAws_restJson1ResultList(output.Results, context) : undefined,
651
784
  };
652
785
  };
653
- const deserializeAws_restJson1TranscriptEvent = (output, context) => {
786
+ var deserializeAws_restJson1TranscriptEvent = function (output, context) {
654
787
  return {
655
788
  Transcript: output.Transcript != null ? deserializeAws_restJson1Transcript(output.Transcript, context) : undefined,
656
789
  };
657
790
  };
658
- const deserializeMetadata = (output) => ({
659
- httpStatusCode: output.statusCode,
660
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
661
- extendedRequestId: output.headers["x-amz-id-2"],
662
- cfId: output.headers["x-amz-cf-id"],
663
- });
664
- const collectBody = (streamBody = new Uint8Array(), context) => {
791
+ var deserializeMetadata = function (output) {
792
+ var _a, _b;
793
+ return ({
794
+ httpStatusCode: output.statusCode,
795
+ requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
796
+ extendedRequestId: output.headers["x-amz-id-2"],
797
+ cfId: output.headers["x-amz-cf-id"],
798
+ });
799
+ };
800
+ var collectBody = function (streamBody, context) {
801
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
665
802
  if (streamBody instanceof Uint8Array) {
666
803
  return Promise.resolve(streamBody);
667
804
  }
668
805
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
669
806
  };
670
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
671
- const isSerializableHeaderValue = (value) => value !== undefined &&
672
- value !== null &&
673
- value !== "" &&
674
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
675
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
676
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
677
- if (encoded.length) {
678
- return JSON.parse(encoded);
679
- }
680
- return {};
681
- });
682
- const parseErrorBody = async (errorBody, context) => {
683
- const value = await parseBody(errorBody, context);
684
- value.message = value.message ?? value.Message;
685
- return value;
686
- };
687
- const loadRestJsonErrorCode = (output, data) => {
688
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
689
- const sanitizeErrorCode = (rawValue) => {
690
- let cleanValue = rawValue;
807
+ var collectBodyString = function (streamBody, context) {
808
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
809
+ };
810
+ var isSerializableHeaderValue = function (value) {
811
+ return value !== undefined &&
812
+ value !== null &&
813
+ value !== "" &&
814
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
815
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
816
+ };
817
+ var parseBody = function (streamBody, context) {
818
+ return collectBodyString(streamBody, context).then(function (encoded) {
819
+ if (encoded.length) {
820
+ return JSON.parse(encoded);
821
+ }
822
+ return {};
823
+ });
824
+ };
825
+ var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
826
+ var value;
827
+ var _a;
828
+ return __generator(this, function (_b) {
829
+ switch (_b.label) {
830
+ case 0: return [4, parseBody(errorBody, context)];
831
+ case 1:
832
+ value = _b.sent();
833
+ value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
834
+ return [2, value];
835
+ }
836
+ });
837
+ }); };
838
+ var loadRestJsonErrorCode = function (output, data) {
839
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
840
+ var sanitizeErrorCode = function (rawValue) {
841
+ var cleanValue = rawValue;
691
842
  if (typeof cleanValue === "number") {
692
843
  cleanValue = cleanValue.toString();
693
844
  }
@@ -702,7 +853,7 @@ const loadRestJsonErrorCode = (output, data) => {
702
853
  }
703
854
  return cleanValue;
704
855
  };
705
- const headerKey = findKey(output.headers, "x-amzn-errortype");
856
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
706
857
  if (headerKey !== undefined) {
707
858
  return sanitizeErrorCode(output.headers[headerKey]);
708
859
  }