File tree Expand file tree Collapse file tree 2 files changed +56
-2
lines changed Expand file tree Collapse file tree 2 files changed +56
-2
lines changed Original file line number Diff line number Diff line change @@ -36,12 +36,44 @@ export class Client<
36
36
SmithyResolvedConfiguration < HandlerOptions >
37
37
> ,
38
38
options ?: HandlerOptions
39
- ) : Promise < OutputType > {
39
+ ) : Promise < OutputType > ;
40
+ send < InputType extends ClientInput , OutputType extends ClientOutput > (
41
+ command : Command <
42
+ ClientInput ,
43
+ InputType ,
44
+ ClientOutput ,
45
+ OutputType ,
46
+ SmithyResolvedConfiguration < HandlerOptions >
47
+ > ,
48
+ options : HandlerOptions ,
49
+ cb : ( err : any , data ?: OutputType ) => void
50
+ ) : void ;
51
+ send < InputType extends ClientInput , OutputType extends ClientOutput > (
52
+ command : Command <
53
+ ClientInput ,
54
+ InputType ,
55
+ ClientOutput ,
56
+ OutputType ,
57
+ SmithyResolvedConfiguration < HandlerOptions >
58
+ > ,
59
+ options ?: HandlerOptions ,
60
+ cb ?: ( err : any , data ?: OutputType ) => void
61
+ ) : Promise < OutputType > | void {
40
62
const handler = command . resolveMiddleware (
41
63
this . middlewareStack as any ,
42
64
this . config ,
43
65
options
44
66
) ;
45
- return handler ( command ) . then ( result => result . output ) ;
67
+ if ( cb ) {
68
+ handler ( command )
69
+ . then ( result => cb ( null , result . output ) , ( err : any ) => cb ( err ) )
70
+ . catch (
71
+ // prevent any errors thrown in the callback from triggering an
72
+ // unhandled promise rejection
73
+ ( ) => { }
74
+ ) ;
75
+ } else {
76
+ return handler ( command ) . then ( result => result . output ) ;
77
+ }
46
78
}
47
79
}
Original file line number Diff line number Diff line change @@ -20,6 +20,28 @@ interface InvokeFunction<
20
20
> ,
21
21
options ?: any
22
22
) : Promise < OutputType > ;
23
+ < InputType extends InputTypes , OutputType extends OutputTypes > (
24
+ command : Command <
25
+ InputTypes ,
26
+ InputType ,
27
+ OutputTypes ,
28
+ OutputType ,
29
+ ResolvedClientConfiguration
30
+ > ,
31
+ options : any ,
32
+ cb : ( err : any , data ?: OutputType ) => void
33
+ ) : void ;
34
+ < InputType extends InputTypes , OutputType extends OutputTypes > (
35
+ command : Command <
36
+ InputTypes ,
37
+ InputType ,
38
+ OutputTypes ,
39
+ OutputType ,
40
+ ResolvedClientConfiguration
41
+ > ,
42
+ options ?: any ,
43
+ cb ?: ( err : any , data ?: OutputType ) => void
44
+ ) : Promise < OutputType > | void ;
23
45
}
24
46
25
47
/**
You can’t perform that action at this time.
0 commit comments