@@ -105,7 +105,8 @@ private void generateClientCommand() {
105
105
writer .addImport ("MiddlewareStack" , "MiddlewareStack" , "@aws-sdk/types" );
106
106
107
107
String name = symbol .getName ();
108
- writer .writeShapeDocs (operation );
108
+ writer .writeShapeDocs (operation , shapeDoc -> shapeDoc + "\n " + getCommandExample (serviceSymbol .getName (),
109
+ configType , name , inputType .getName (), outputType .getName ()));
109
110
writer .openBlock ("export class $L extends $$Command<$T, $T, $L> {" , "}" , name , inputType , outputType ,
110
111
configType , () -> {
111
112
@@ -128,6 +129,26 @@ private void generateClientCommand() {
128
129
});
129
130
}
130
131
132
+ private String getCommandExample (String serviceName , String configName , String commandName , String commandInput ,
133
+ String commandOutput ) {
134
+ String packageName = settings .getPackageName ();
135
+ return "@example\n "
136
+ + "User a bare-bones client and the command you need to make an API call.\n "
137
+ + "```javascript\n "
138
+ + String .format ("import { %s, %s } from \" %s\" ; // ES Modules import%n" , serviceName , commandName ,
139
+ packageName )
140
+ + String .format ("// const { %s, %s } = require(\" %s\" ); // CommonJS import%n" , serviceName , commandName ,
141
+ packageName )
142
+ + String .format ("const client = new %s(config);%n" , serviceName )
143
+ + String .format ("const command = new %s(input);%n" , commandName )
144
+ + "const response = await client.send(command);\n "
145
+ + "```\n "
146
+ + "\n "
147
+ + String .format ("@see {@link %s} for command's `input` shape.%n" , commandInput )
148
+ + String .format ("@see {@link %s} for command's `response` shape.%n" , commandOutput )
149
+ + String .format ("@see {@link %s | config} for command's `input` shape.%n" , configName );
150
+ }
151
+
131
152
private void generateCommandConstructor () {
132
153
writer .openBlock ("constructor(readonly input: $T) {" , "}" , inputType , () -> {
133
154
// The constructor can be intercepted and changed.
0 commit comments