From 283a4c453422332d62210cffd63033accb04f044 Mon Sep 17 00:00:00 2001 From: George Fu Date: Mon, 26 Sep 2022 16:19:59 +0000 Subject: [PATCH] feat(serde): use type mapping to describe stream mixin --- .../src/commands/GetChunkCommand.ts | 13 +----- .../src/commands/GetObjectMetadataCommand.ts | 15 ++----- .../commands/GetPackageVersionAssetCommand.ts | 15 ++----- .../src/commands/GetSnapshotBlockCommand.ts | 15 ++----- .../src/commands/GetJobOutputCommand.ts | 13 +----- .../src/commands/GetClipCommand.ts | 13 +----- .../GetMediaForFragmentListCommand.ts | 15 ++----- .../src/commands/GetMediaCommand.ts | 13 +----- .../src/commands/GetWorkUnitResultsCommand.ts | 15 ++----- .../src/commands/PostContentCommand.ts | 15 ++----- .../src/commands/PutSessionCommand.ts | 15 ++----- .../src/commands/PutSessionCommand.ts | 15 ++----- .../src/commands/RecognizeUtteranceCommand.ts | 15 ++----- .../DescribeInputDeviceThumbnailCommand.ts | 15 ++----- .../src/commands/GetObjectCommand.ts | 13 +----- .../src/commands/SynthesizeSpeechCommand.ts | 15 ++----- .../src/commands/GetObjectCommand.ts | 13 +----- .../src/commands/GetObjectTorrentCommand.ts | 15 ++----- .../commands/GetRawMessageContentCommand.ts | 15 ++----- packages/types/src/serde.ts | 10 +++++ .../test/functional/awsjson1_0.spec.ts | 44 +++++++++++++++++++ .../src/commands/StreamingTraitsCommand.ts | 15 ++----- .../StreamingTraitsWithMediaTypeCommand.ts | 15 ++----- 23 files changed, 126 insertions(+), 231 deletions(-) diff --git a/clients/client-backupstorage/src/commands/GetChunkCommand.ts b/clients/client-backupstorage/src/commands/GetChunkCommand.ts index 582e539711d13..0d7c451dc7075 100644 --- a/clients/client-backupstorage/src/commands/GetChunkCommand.ts +++ b/clients/client-backupstorage/src/commands/GetChunkCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { BackupStorageClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BackupStorageClient"; @@ -27,17 +28,7 @@ import { } from "../protocols/Aws_restJson1"; export interface GetChunkCommandInput extends GetChunkInput {} -type GetChunkCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetChunkOutput["Data"]`*, see {@link GetChunkOutput.Data}. - */ - Data: __SdkStream["Data"]>; - }; -/** - * This interface extends from `GetChunkOutput` interface. There are more parameters than `Data` defined in {@link GetChunkOutput} - */ -export interface GetChunkCommandOutput extends GetChunkCommandOutputType {} +export interface GetChunkCommandOutput extends __WithSdkStreamMixin, __MetadataBearer {} /** * Gets the specified object's chunk. diff --git a/clients/client-backupstorage/src/commands/GetObjectMetadataCommand.ts b/clients/client-backupstorage/src/commands/GetObjectMetadataCommand.ts index 2fa8c7bd42af9..4e05013be4fcd 100644 --- a/clients/client-backupstorage/src/commands/GetObjectMetadataCommand.ts +++ b/clients/client-backupstorage/src/commands/GetObjectMetadataCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { BackupStorageClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BackupStorageClient"; @@ -27,17 +28,9 @@ import { } from "../protocols/Aws_restJson1"; export interface GetObjectMetadataCommandInput extends GetObjectMetadataInput {} -type GetObjectMetadataCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetObjectMetadataOutput["MetadataBlob"]`*, see {@link GetObjectMetadataOutput.MetadataBlob}. - */ - MetadataBlob?: __SdkStream["MetadataBlob"]>; - }; -/** - * This interface extends from `GetObjectMetadataOutput` interface. There are more parameters than `MetadataBlob` defined in {@link GetObjectMetadataOutput} - */ -export interface GetObjectMetadataCommandOutput extends GetObjectMetadataCommandOutputType {} +export interface GetObjectMetadataCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** * Get metadata associated with an Object. diff --git a/clients/client-codeartifact/src/commands/GetPackageVersionAssetCommand.ts b/clients/client-codeartifact/src/commands/GetPackageVersionAssetCommand.ts index c36420b198ff7..e1c3422e628b7 100644 --- a/clients/client-codeartifact/src/commands/GetPackageVersionAssetCommand.ts +++ b/clients/client-codeartifact/src/commands/GetPackageVersionAssetCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { CodeartifactClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CodeartifactClient"; @@ -27,17 +28,9 @@ import { } from "../protocols/Aws_restJson1"; export interface GetPackageVersionAssetCommandInput extends GetPackageVersionAssetRequest {} -type GetPackageVersionAssetCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetPackageVersionAssetResult["asset"]`*, see {@link GetPackageVersionAssetResult.asset}. - */ - asset?: __SdkStream["asset"]>; - }; -/** - * This interface extends from `GetPackageVersionAssetResult` interface. There are more parameters than `asset` defined in {@link GetPackageVersionAssetResult} - */ -export interface GetPackageVersionAssetCommandOutput extends GetPackageVersionAssetCommandOutputType {} +export interface GetPackageVersionAssetCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

diff --git a/clients/client-ebs/src/commands/GetSnapshotBlockCommand.ts b/clients/client-ebs/src/commands/GetSnapshotBlockCommand.ts index 55a829b8de990..f85b7f0328535 100644 --- a/clients/client-ebs/src/commands/GetSnapshotBlockCommand.ts +++ b/clients/client-ebs/src/commands/GetSnapshotBlockCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { EBSClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EBSClient"; @@ -27,17 +28,9 @@ import { } from "../protocols/Aws_restJson1"; export interface GetSnapshotBlockCommandInput extends GetSnapshotBlockRequest {} -type GetSnapshotBlockCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetSnapshotBlockResponse["BlockData"]`*, see {@link GetSnapshotBlockResponse.BlockData}. - */ - BlockData?: __SdkStream["BlockData"]>; - }; -/** - * This interface extends from `GetSnapshotBlockResponse` interface. There are more parameters than `BlockData` defined in {@link GetSnapshotBlockResponse} - */ -export interface GetSnapshotBlockCommandOutput extends GetSnapshotBlockCommandOutputType {} +export interface GetSnapshotBlockCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Returns the data in a block in an Amazon Elastic Block Store snapshot.

diff --git a/clients/client-glacier/src/commands/GetJobOutputCommand.ts b/clients/client-glacier/src/commands/GetJobOutputCommand.ts index 3ebee31f5ba8a..7936260b815ae 100644 --- a/clients/client-glacier/src/commands/GetJobOutputCommand.ts +++ b/clients/client-glacier/src/commands/GetJobOutputCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { GlacierClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GlacierClient"; @@ -27,17 +28,7 @@ import { } from "../protocols/Aws_restJson1"; export interface GetJobOutputCommandInput extends GetJobOutputInput {} -type GetJobOutputCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetJobOutputOutput["body"]`*, see {@link GetJobOutputOutput.body}. - */ - body?: __SdkStream["body"]>; - }; -/** - * This interface extends from `GetJobOutputOutput` interface. There are more parameters than `body` defined in {@link GetJobOutputOutput} - */ -export interface GetJobOutputCommandOutput extends GetJobOutputCommandOutputType {} +export interface GetJobOutputCommandOutput extends __WithSdkStreamMixin, __MetadataBearer {} /** *

This operation downloads the output of the job you initiated using InitiateJob. Depending on the job type you specified when you initiated the diff --git a/clients/client-kinesis-video-archived-media/src/commands/GetClipCommand.ts b/clients/client-kinesis-video-archived-media/src/commands/GetClipCommand.ts index ab19400558c6f..42601f5317726 100644 --- a/clients/client-kinesis-video-archived-media/src/commands/GetClipCommand.ts +++ b/clients/client-kinesis-video-archived-media/src/commands/GetClipCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -31,17 +32,7 @@ import { } from "../protocols/Aws_restJson1"; export interface GetClipCommandInput extends GetClipInput {} -type GetClipCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetClipOutput["Payload"]`*, see {@link GetClipOutput.Payload}. - */ - Payload?: __SdkStream["Payload"]>; - }; -/** - * This interface extends from `GetClipOutput` interface. There are more parameters than `Payload` defined in {@link GetClipOutput} - */ -export interface GetClipCommandOutput extends GetClipCommandOutputType {} +export interface GetClipCommandOutput extends __WithSdkStreamMixin, __MetadataBearer {} /** *

Downloads an MP4 file (clip) containing the archived, on-demand media from the diff --git a/clients/client-kinesis-video-archived-media/src/commands/GetMediaForFragmentListCommand.ts b/clients/client-kinesis-video-archived-media/src/commands/GetMediaForFragmentListCommand.ts index d87c30c8da3cd..ab0e23ad7cdb8 100644 --- a/clients/client-kinesis-video-archived-media/src/commands/GetMediaForFragmentListCommand.ts +++ b/clients/client-kinesis-video-archived-media/src/commands/GetMediaForFragmentListCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -31,17 +32,9 @@ import { } from "../protocols/Aws_restJson1"; export interface GetMediaForFragmentListCommandInput extends GetMediaForFragmentListInput {} -type GetMediaForFragmentListCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetMediaForFragmentListOutput["Payload"]`*, see {@link GetMediaForFragmentListOutput.Payload}. - */ - Payload?: __SdkStream["Payload"]>; - }; -/** - * This interface extends from `GetMediaForFragmentListOutput` interface. There are more parameters than `Payload` defined in {@link GetMediaForFragmentListOutput} - */ -export interface GetMediaForFragmentListCommandOutput extends GetMediaForFragmentListCommandOutputType {} +export interface GetMediaForFragmentListCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Gets media for a list of fragments (specified by fragment number) from the archived diff --git a/clients/client-kinesis-video-media/src/commands/GetMediaCommand.ts b/clients/client-kinesis-video-media/src/commands/GetMediaCommand.ts index 6b7a6dfff7145..6fb0caa7bc328 100644 --- a/clients/client-kinesis-video-media/src/commands/GetMediaCommand.ts +++ b/clients/client-kinesis-video-media/src/commands/GetMediaCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -31,17 +32,7 @@ import { } from "../protocols/Aws_restJson1"; export interface GetMediaCommandInput extends GetMediaInput {} -type GetMediaCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetMediaOutput["Payload"]`*, see {@link GetMediaOutput.Payload}. - */ - Payload?: __SdkStream["Payload"]>; - }; -/** - * This interface extends from `GetMediaOutput` interface. There are more parameters than `Payload` defined in {@link GetMediaOutput} - */ -export interface GetMediaCommandOutput extends GetMediaCommandOutputType {} +export interface GetMediaCommandOutput extends __WithSdkStreamMixin, __MetadataBearer {} /** *

Use this API to retrieve media content from a Kinesis video stream. In the request, diff --git a/clients/client-lakeformation/src/commands/GetWorkUnitResultsCommand.ts b/clients/client-lakeformation/src/commands/GetWorkUnitResultsCommand.ts index 8d3eca66c74d0..a97d55f8284d2 100644 --- a/clients/client-lakeformation/src/commands/GetWorkUnitResultsCommand.ts +++ b/clients/client-lakeformation/src/commands/GetWorkUnitResultsCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { LakeFormationClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LakeFormationClient"; @@ -27,17 +28,9 @@ import { } from "../protocols/Aws_restJson1"; export interface GetWorkUnitResultsCommandInput extends GetWorkUnitResultsRequest {} -type GetWorkUnitResultsCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetWorkUnitResultsResponse["ResultStream"]`*, see {@link GetWorkUnitResultsResponse.ResultStream}. - */ - ResultStream?: __SdkStream["ResultStream"]>; - }; -/** - * This interface extends from `GetWorkUnitResultsResponse` interface. There are more parameters than `ResultStream` defined in {@link GetWorkUnitResultsResponse} - */ -export interface GetWorkUnitResultsCommandOutput extends GetWorkUnitResultsCommandOutputType {} +export interface GetWorkUnitResultsCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Returns the work units resulting from the query. Work units can be executed in any order and in parallel.

diff --git a/clients/client-lex-runtime-service/src/commands/PostContentCommand.ts b/clients/client-lex-runtime-service/src/commands/PostContentCommand.ts index c911b5b7325cc..5633cc22a394e 100644 --- a/clients/client-lex-runtime-service/src/commands/PostContentCommand.ts +++ b/clients/client-lex-runtime-service/src/commands/PostContentCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -40,17 +41,9 @@ type PostContentCommandInputType = Omit & { * This interface extends from `PostContentRequest` interface. There are more parameters than `inputStream` defined in {@link PostContentRequest} */ export interface PostContentCommandInput extends PostContentCommandInputType {} -type PostContentCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`PostContentResponse["audioStream"]`*, see {@link PostContentResponse.audioStream}. - */ - audioStream?: __SdkStream["audioStream"]>; - }; -/** - * This interface extends from `PostContentResponse` interface. There are more parameters than `audioStream` defined in {@link PostContentResponse} - */ -export interface PostContentCommandOutput extends PostContentCommandOutputType {} +export interface PostContentCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Sends user input (text or speech) to Amazon Lex. Clients use this API to diff --git a/clients/client-lex-runtime-service/src/commands/PutSessionCommand.ts b/clients/client-lex-runtime-service/src/commands/PutSessionCommand.ts index 5d62cc10feb57..a1e1b17f0e0d2 100644 --- a/clients/client-lex-runtime-service/src/commands/PutSessionCommand.ts +++ b/clients/client-lex-runtime-service/src/commands/PutSessionCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -31,17 +32,9 @@ import { } from "../protocols/Aws_restJson1"; export interface PutSessionCommandInput extends PutSessionRequest {} -type PutSessionCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`PutSessionResponse["audioStream"]`*, see {@link PutSessionResponse.audioStream}. - */ - audioStream?: __SdkStream["audioStream"]>; - }; -/** - * This interface extends from `PutSessionResponse` interface. There are more parameters than `audioStream` defined in {@link PutSessionResponse} - */ -export interface PutSessionCommandOutput extends PutSessionCommandOutputType {} +export interface PutSessionCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Creates a new session or modifies an existing session with an Amazon Lex diff --git a/clients/client-lex-runtime-v2/src/commands/PutSessionCommand.ts b/clients/client-lex-runtime-v2/src/commands/PutSessionCommand.ts index d461994fad188..645c106a30f8d 100644 --- a/clients/client-lex-runtime-v2/src/commands/PutSessionCommand.ts +++ b/clients/client-lex-runtime-v2/src/commands/PutSessionCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { LexRuntimeV2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LexRuntimeV2Client"; @@ -27,17 +28,9 @@ import { } from "../protocols/Aws_restJson1"; export interface PutSessionCommandInput extends PutSessionRequest {} -type PutSessionCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`PutSessionResponse["audioStream"]`*, see {@link PutSessionResponse.audioStream}. - */ - audioStream?: __SdkStream["audioStream"]>; - }; -/** - * This interface extends from `PutSessionResponse` interface. There are more parameters than `audioStream` defined in {@link PutSessionResponse} - */ -export interface PutSessionCommandOutput extends PutSessionCommandOutputType {} +export interface PutSessionCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Creates a new session or modifies an existing session with an Amazon Lex V2 diff --git a/clients/client-lex-runtime-v2/src/commands/RecognizeUtteranceCommand.ts b/clients/client-lex-runtime-v2/src/commands/RecognizeUtteranceCommand.ts index 0909cb93a0524..5d56d926195bd 100644 --- a/clients/client-lex-runtime-v2/src/commands/RecognizeUtteranceCommand.ts +++ b/clients/client-lex-runtime-v2/src/commands/RecognizeUtteranceCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { LexRuntimeV2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LexRuntimeV2Client"; @@ -36,17 +37,9 @@ type RecognizeUtteranceCommandInputType = Omit & { - /** - * For *`RecognizeUtteranceResponse["audioStream"]`*, see {@link RecognizeUtteranceResponse.audioStream}. - */ - audioStream?: __SdkStream["audioStream"]>; - }; -/** - * This interface extends from `RecognizeUtteranceResponse` interface. There are more parameters than `audioStream` defined in {@link RecognizeUtteranceResponse} - */ -export interface RecognizeUtteranceCommandOutput extends RecognizeUtteranceCommandOutputType {} +export interface RecognizeUtteranceCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Sends user input to Amazon Lex V2. You can send text or speech. Clients use diff --git a/clients/client-medialive/src/commands/DescribeInputDeviceThumbnailCommand.ts b/clients/client-medialive/src/commands/DescribeInputDeviceThumbnailCommand.ts index c248ee07c77e0..19c3925ddb939 100644 --- a/clients/client-medialive/src/commands/DescribeInputDeviceThumbnailCommand.ts +++ b/clients/client-medialive/src/commands/DescribeInputDeviceThumbnailCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { MediaLiveClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../MediaLiveClient"; @@ -27,17 +28,9 @@ import { } from "../protocols/Aws_restJson1"; export interface DescribeInputDeviceThumbnailCommandInput extends DescribeInputDeviceThumbnailRequest {} -type DescribeInputDeviceThumbnailCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`DescribeInputDeviceThumbnailResponse["Body"]`*, see {@link DescribeInputDeviceThumbnailResponse.Body}. - */ - Body?: __SdkStream["Body"]>; - }; -/** - * This interface extends from `DescribeInputDeviceThumbnailResponse` interface. There are more parameters than `Body` defined in {@link DescribeInputDeviceThumbnailResponse} - */ -export interface DescribeInputDeviceThumbnailCommandOutput extends DescribeInputDeviceThumbnailCommandOutputType {} +export interface DescribeInputDeviceThumbnailCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** * Get the latest thumbnail data for the input device. diff --git a/clients/client-mediastore-data/src/commands/GetObjectCommand.ts b/clients/client-mediastore-data/src/commands/GetObjectCommand.ts index 937d2cc91e436..a87efabf9fa5c 100644 --- a/clients/client-mediastore-data/src/commands/GetObjectCommand.ts +++ b/clients/client-mediastore-data/src/commands/GetObjectCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { MediaStoreDataClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../MediaStoreDataClient"; @@ -27,17 +28,7 @@ import { } from "../protocols/Aws_restJson1"; export interface GetObjectCommandInput extends GetObjectRequest {} -type GetObjectCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetObjectResponse["Body"]`*, see {@link GetObjectResponse.Body}. - */ - Body?: __SdkStream["Body"]>; - }; -/** - * This interface extends from `GetObjectResponse` interface. There are more parameters than `Body` defined in {@link GetObjectResponse} - */ -export interface GetObjectCommandOutput extends GetObjectCommandOutputType {} +export interface GetObjectCommandOutput extends __WithSdkStreamMixin, __MetadataBearer {} /** *

Downloads the object at the specified path. If the object’s upload availability is set to streaming, AWS Elemental MediaStore downloads the object even if it’s still uploading the object.

diff --git a/clients/client-polly/src/commands/SynthesizeSpeechCommand.ts b/clients/client-polly/src/commands/SynthesizeSpeechCommand.ts index fb68c9dd6e69f..239bf0927f17d 100644 --- a/clients/client-polly/src/commands/SynthesizeSpeechCommand.ts +++ b/clients/client-polly/src/commands/SynthesizeSpeechCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -27,17 +28,9 @@ import { } from "../protocols/Aws_restJson1"; export interface SynthesizeSpeechCommandInput extends SynthesizeSpeechInput {} -type SynthesizeSpeechCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`SynthesizeSpeechOutput["AudioStream"]`*, see {@link SynthesizeSpeechOutput.AudioStream}. - */ - AudioStream?: __SdkStream["AudioStream"]>; - }; -/** - * This interface extends from `SynthesizeSpeechOutput` interface. There are more parameters than `AudioStream` defined in {@link SynthesizeSpeechOutput} - */ -export interface SynthesizeSpeechCommandOutput extends SynthesizeSpeechCommandOutputType {} +export interface SynthesizeSpeechCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. diff --git a/clients/client-s3/src/commands/GetObjectCommand.ts b/clients/client-s3/src/commands/GetObjectCommand.ts index 1954905801442..6ec0626172977 100644 --- a/clients/client-s3/src/commands/GetObjectCommand.ts +++ b/clients/client-s3/src/commands/GetObjectCommand.ts @@ -15,6 +15,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -27,17 +28,7 @@ import { deserializeAws_restXmlGetObjectCommand, serializeAws_restXmlGetObjectCo import { S3ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../S3Client"; export interface GetObjectCommandInput extends GetObjectRequest {} -type GetObjectCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetObjectOutput["Body"]`*, see {@link GetObjectOutput.Body}. - */ - Body?: __SdkStream["Body"]>; - }; -/** - * This interface extends from `GetObjectOutput` interface. There are more parameters than `Body` defined in {@link GetObjectOutput} - */ -export interface GetObjectCommandOutput extends GetObjectCommandOutputType {} +export interface GetObjectCommandOutput extends __WithSdkStreamMixin, __MetadataBearer {} /** *

Retrieves objects from Amazon S3. To use GET, you must have READ diff --git a/clients/client-s3/src/commands/GetObjectTorrentCommand.ts b/clients/client-s3/src/commands/GetObjectTorrentCommand.ts index 666a5e2aa49e4..984647a80591e 100644 --- a/clients/client-s3/src/commands/GetObjectTorrentCommand.ts +++ b/clients/client-s3/src/commands/GetObjectTorrentCommand.ts @@ -13,6 +13,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -28,17 +29,9 @@ import { import { S3ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../S3Client"; export interface GetObjectTorrentCommandInput extends GetObjectTorrentRequest {} -type GetObjectTorrentCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetObjectTorrentOutput["Body"]`*, see {@link GetObjectTorrentOutput.Body}. - */ - Body?: __SdkStream["Body"]>; - }; -/** - * This interface extends from `GetObjectTorrentOutput` interface. There are more parameters than `Body` defined in {@link GetObjectTorrentOutput} - */ -export interface GetObjectTorrentCommandOutput extends GetObjectTorrentCommandOutputType {} +export interface GetObjectTorrentCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Returns torrent files from a bucket. BitTorrent can save you bandwidth when you're diff --git a/clients/client-workmailmessageflow/src/commands/GetRawMessageContentCommand.ts b/clients/client-workmailmessageflow/src/commands/GetRawMessageContentCommand.ts index 69627a75932cd..1750ba3fcd39a 100644 --- a/clients/client-workmailmessageflow/src/commands/GetRawMessageContentCommand.ts +++ b/clients/client-workmailmessageflow/src/commands/GetRawMessageContentCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -31,17 +32,9 @@ import { } from "../WorkMailMessageFlowClient"; export interface GetRawMessageContentCommandInput extends GetRawMessageContentRequest {} -type GetRawMessageContentCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`GetRawMessageContentResponse["messageContent"]`*, see {@link GetRawMessageContentResponse.messageContent}. - */ - messageContent: __SdkStream["messageContent"]>; - }; -/** - * This interface extends from `GetRawMessageContentResponse` interface. There are more parameters than `messageContent` defined in {@link GetRawMessageContentResponse} - */ -export interface GetRawMessageContentCommandOutput extends GetRawMessageContentCommandOutputType {} +export interface GetRawMessageContentCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** *

Retrieves the raw content of an in-transit email message, in MIME format.

diff --git a/packages/types/src/serde.ts b/packages/types/src/serde.ts index d730b38fae8ad..2455739e47ffc 100644 --- a/packages/types/src/serde.ts +++ b/packages/types/src/serde.ts @@ -86,6 +86,15 @@ export interface SdkStreamMixin { */ export type SdkStream = BaseStream & SdkStreamMixin; +/** + * Indicates that any members of type T + * that were of type BaseStream have been extended + * with the SdkStreamMixin helper methods. + */ +export type WithSdkStreamMixin = { + [key in keyof T]: T[key] extends BaseStream ? SdkStream : T[key] +} + /** * Interface for internal function to inject stream utility functions * implementation @@ -102,3 +111,4 @@ export interface SdkStreamMixinInjector { export interface SdkStreamSerdeContext { sdkStreamMixin: SdkStreamMixinInjector; } + diff --git a/private/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts b/private/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts index 419b614557413..91ca38583bc90 100644 --- a/private/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts +++ b/private/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts @@ -322,6 +322,50 @@ it("AwsJson10InvalidGreetingError:Error:GreetingWithErrors", async () => { fail("Expected an exception to be thrown from response"); }); +/** + * @awsQueryCompatible trait is applied to service + */ +it("Json10WithQueryCompatibleGreetingError:Error:GreetingWithErrors", async () => { + const client = new JSONRPC10Client({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + false, + 402, + { + "x-amzn-query-error": "CustomGreetingErrorCode;Sender", + "content-type": "application/x-amz-json-1.0", + }, + `{"__type": "InvalidGreetingError","Message": "Hi"}` + ), + }); + + const params: any = {}; + const command = new GreetingWithErrorsCommand(params); + + try { + await client.send(command); + } catch (err) { + if (err.name !== "InvalidGreeting") { + console.log(err); + fail(`Expected a InvalidGreeting to be thrown, got ${err.name} instead`); + return; + } + const r: any = err; + expect(r["$metadata"].httpStatusCode).toBe(402); + const paramsToValidate: any = [ + { + message: "Hi", + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); + return; + } + fail("Expected an exception to be thrown from response"); +}); + /** * Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS. */ diff --git a/private/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts b/private/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts index ecd8613b17d63..4d3d500d24394 100644 --- a/private/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts +++ b/private/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { StreamingTraitsInputOutput, StreamingTraitsInputOutputFilterSensitiveLog } from "../models/models_0"; @@ -31,17 +32,9 @@ type StreamingTraitsCommandInputType = Omit * This interface extends from `StreamingTraitsInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsInputOutput} */ export interface StreamingTraitsCommandInput extends StreamingTraitsCommandInputType {} -type StreamingTraitsCommandOutputType = __MetadataBearer & - Omit & { - /** - * For *`StreamingTraitsInputOutput["blob"]`*, see {@link StreamingTraitsInputOutput.blob}. - */ - blob?: __SdkStream["blob"]>; - }; -/** - * This interface extends from `StreamingTraitsInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsInputOutput} - */ -export interface StreamingTraitsCommandOutput extends StreamingTraitsCommandOutputType {} +export interface StreamingTraitsCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** * This examples serializes a streaming blob shape in the request body. diff --git a/private/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts b/private/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts index 3d6a9c0a97aa8..ee4651c26220a 100644 --- a/private/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts +++ b/private/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts @@ -12,6 +12,7 @@ import { SdkStream as __SdkStream, SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, + WithSdkStreamMixin as __WithSdkStreamMixin, } from "@aws-sdk/types"; import { @@ -34,17 +35,9 @@ type StreamingTraitsWithMediaTypeCommandInputType = Omit & { - /** - * For *`StreamingTraitsWithMediaTypeInputOutput["blob"]`*, see {@link StreamingTraitsWithMediaTypeInputOutput.blob}. - */ - blob?: __SdkStream["blob"]>; - }; -/** - * This interface extends from `StreamingTraitsWithMediaTypeInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsWithMediaTypeInputOutput} - */ -export interface StreamingTraitsWithMediaTypeCommandOutput extends StreamingTraitsWithMediaTypeCommandOutputType {} +export interface StreamingTraitsWithMediaTypeCommandOutput + extends __WithSdkStreamMixin, + __MetadataBearer {} /** * This examples serializes a streaming media-typed blob shape in the request body.