Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow commands to be constructed without arg if all arg fields optional #1206

Merged
merged 7 commits into from
Mar 14, 2024

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Mar 14, 2024

currently:

new GetCallerIdentity({}); // empty argument required
sts.getCallerIdentity({}); // empty argument required

new PutObjectCommand({ Key: "", Bucket: "" }); // non-empty argument required
s3.putObject({ Key: "", Bucket: "" }); // non-empty argument required

in this PR, feature:

new GetCallerIdentity(); // argument may be omitted
sts.getCallerIdentity(); // argument may be omitted (codegen TODO)

new PutObjectCommand({ Key: "", Bucket: "" }); // non-empty argument still required
s3.putObject({ Key: "", Bucket: "" }); // non-empty argument still required

@kuhe kuhe requested review from a team as code owners March 14, 2024 16:00
@kuhe kuhe requested a review from hpmellema March 14, 2024 16:01
packages/smithy-client/src/command.spec.ts Show resolved Hide resolved
packages/types/src/util.ts Outdated Show resolved Hide resolved
@kuhe
Copy link
Contributor Author

kuhe commented Mar 14, 2024

For aggregated clients, a no-arg signature will be added if no required members are found.

  /**
   * @see {@link ListBucketsCommand}
   */
  listBuckets(): Promise<ListBucketsCommandOutput>;
  listBuckets(args: ListBucketsCommandInput, options?: __HttpHandlerOptions): Promise<ListBucketsCommandOutput>;
  listBuckets(args: ListBucketsCommandInput, cb: (err: any, data?: ListBucketsCommandOutput) => void): void;
  listBuckets(
    args: ListBucketsCommandInput,
    options: __HttpHandlerOptions,
    cb: (err: any, data?: ListBucketsCommandOutput) => void
  ): void;

@kuhe
Copy link
Contributor Author

kuhe commented Mar 14, 2024

this addresses aws/aws-sdk-js-v3#4579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants