Skip to content

Commit 18fe335

Browse files
committed
generate streamingBlobOutput type to code example
1 parent 78c1ba0 commit 18fe335

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/CommandGenerator.java

+10
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ private String getCommandExample(String serviceName, String configName, String c
260260
model.getShape(operation.getInputShape()).get(), model, false, true))
261261
+ String.format("const command = new %s(input);%n", commandName)
262262
+ "const response = await client.send(command);\n"
263+
+ getReadStreamExample()
263264
+ String.format("%s%n",
264265
StructureExampleGenerator.generateStructuralHintDocumentation(
265266
model.getShape(operation.getOutputShape()).get(), model, true, false))
@@ -272,6 +273,15 @@ private String getCommandExample(String serviceName, String configName, String c
272273
+ String.format("@see {@link %s | config} for %s's `config` shape.%n", configName, serviceName);
273274
}
274275

276+
private String getReadStreamExample() {
277+
boolean hasStreamingBlobOutput = false;
278+
if (hasStreamingBlobOutput) {
279+
String memberName = "";
280+
return "const byte = await response[`%s`].transformToByteArray();".formatted(memberName);
281+
}
282+
return "";
283+
}
284+
275285
private String getThrownExceptions() {
276286
List<ShapeId> errors = operation.getErrors();
277287
StringBuilder buffer = new StringBuilder();

0 commit comments

Comments
 (0)