@@ -27,7 +27,8 @@ import Transport, {
27
27
TransportRequestParams ,
28
28
TransportRequestOptions ,
29
29
nodeFilterFn ,
30
- nodeSelectorFn
30
+ nodeSelectorFn ,
31
+ TransportRequestCallback
31
32
} from './lib/Transport' ;
32
33
import Connection , { AgentOptions , agentFn } from './lib/Connection' ;
33
34
import ConnectionPool , { ResurrectEvent } from './lib/ConnectionPool' ;
@@ -38,12 +39,18 @@ import * as errors from './lib/errors';
38
39
declare type anyObject = {
39
40
[ key : string ] : any ;
40
41
} ;
41
- declare type callbackFn = ( err : Error | null , result : ApiResponse ) => void ;
42
42
43
- interface ApiMethod < T > {
44
- ( callback ?: callbackFn ) : any ;
45
- ( params : T , callback ?: callbackFn ) : any ;
46
- ( params : T , options : TransportRequestOptions , callback ?: callbackFn ) : any ;
43
+ declare type callbackFn < T > = ( err : Error | null , result : ApiResponse < T > ) => void ;
44
+
45
+ interface ApiMethod < TParams , TBody = any > {
46
+ // Promise API
47
+ ( ) : Promise < ApiResponse < TBody > > ;
48
+ ( params : TParams ) : Promise < ApiResponse < TBody > > ;
49
+ ( params : TParams , options : TransportRequestOptions ) : Promise < ApiResponse < TBody > > ;
50
+ // Callback API
51
+ ( callback : callbackFn < TBody > ) : TransportRequestCallback ;
52
+ ( params : TParams , callback : callbackFn < TBody > ) : TransportRequestCallback ;
53
+ ( params : TParams , options : TransportRequestOptions , callback : callbackFn < TBody > ) : TransportRequestCallback ;
47
54
}
48
55
49
56
// Extend API
@@ -570,5 +577,6 @@ export {
570
577
RequestEvent ,
571
578
ResurrectEvent ,
572
579
RequestParams ,
580
+ ClientOptions ,
573
581
ClientExtendsCallbackOptions
574
582
} ;
0 commit comments