Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(smithy-client): factory for aggregated clients
- Loading branch information
Showing
10 changed files
with
1,737 additions
and
11,834 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,41 @@ | ||
// smithy-typescript generated code | ||
import { EchoServiceClient } from "./EchoServiceClient"; | ||
import { EchoServiceClient, EchoServiceClientConfig } from "./EchoServiceClient"; | ||
import { EchoCommand, EchoCommandInput, EchoCommandOutput } from "./commands/EchoCommand"; | ||
import { LengthCommand, LengthCommandInput, LengthCommandOutput } from "./commands/LengthCommand"; | ||
import { createProxyClient } from "@aws-sdk/smithy-client"; | ||
import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; | ||
|
||
/** | ||
* @public | ||
*/ | ||
export class EchoService extends EchoServiceClient { | ||
const commands = { | ||
EchoCommand, | ||
LengthCommand, | ||
}; | ||
export interface EchoService { | ||
/** | ||
* @public | ||
* @see {@link EchoCommand} | ||
*/ | ||
public echo(args: EchoCommandInput, options?: __HttpHandlerOptions): Promise<EchoCommandOutput>; | ||
public echo(args: EchoCommandInput, cb: (err: any, data?: EchoCommandOutput) => void): void; | ||
public echo( | ||
args: EchoCommandInput, | ||
options: __HttpHandlerOptions, | ||
cb: (err: any, data?: EchoCommandOutput) => void | ||
): void; | ||
public echo( | ||
args: EchoCommandInput, | ||
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: EchoCommandOutput) => void), | ||
cb?: (err: any, data?: EchoCommandOutput) => void | ||
): Promise<EchoCommandOutput> | void { | ||
const command = new EchoCommand(args); | ||
if (typeof optionsOrCb === "function") { | ||
this.send(command, optionsOrCb); | ||
} else if (typeof cb === "function") { | ||
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); | ||
this.send(command, optionsOrCb || {}, cb); | ||
} else { | ||
return this.send(command, optionsOrCb); | ||
} | ||
} | ||
echo(args: EchoCommandInput, options?: __HttpHandlerOptions): Promise<EchoCommandOutput>; | ||
echo(args: EchoCommandInput, cb: (err: any, data?: EchoCommandOutput) => void): void; | ||
echo(args: EchoCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: EchoCommandOutput) => void): void; | ||
|
||
/** | ||
* @public | ||
* @see {@link LengthCommand} | ||
*/ | ||
public length(args: LengthCommandInput, options?: __HttpHandlerOptions): Promise<LengthCommandOutput>; | ||
public length(args: LengthCommandInput, cb: (err: any, data?: LengthCommandOutput) => void): void; | ||
public length( | ||
length(args: LengthCommandInput, options?: __HttpHandlerOptions): Promise<LengthCommandOutput>; | ||
length(args: LengthCommandInput, cb: (err: any, data?: LengthCommandOutput) => void): void; | ||
length( | ||
args: LengthCommandInput, | ||
options: __HttpHandlerOptions, | ||
cb: (err: any, data?: LengthCommandOutput) => void | ||
): void; | ||
public length( | ||
args: LengthCommandInput, | ||
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: LengthCommandOutput) => void), | ||
cb?: (err: any, data?: LengthCommandOutput) => void | ||
): Promise<LengthCommandOutput> | void { | ||
const command = new LengthCommand(args); | ||
if (typeof optionsOrCb === "function") { | ||
this.send(command, optionsOrCb); | ||
} else if (typeof cb === "function") { | ||
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); | ||
this.send(command, optionsOrCb || {}, cb); | ||
} else { | ||
return this.send(command, optionsOrCb); | ||
} | ||
} | ||
|
||
/** | ||
* @public | ||
*/ | ||
export class EchoService extends EchoServiceClient implements EchoService { | ||
public constructor(config: EchoServiceClientConfig) { | ||
super(config); | ||
const target: any = {}; | ||
return createProxyClient(target, commands, this); | ||
} | ||
} |
Oops, something went wrong.