@@ -27,7 +27,8 @@ import Transport, {
2727 TransportRequestParams ,
2828 TransportRequestOptions ,
2929 nodeFilterFn ,
30- nodeSelectorFn
30+ nodeSelectorFn ,
31+ TransportRequestCallback
3132} from './lib/Transport' ;
3233import Connection , { AgentOptions , agentFn } from './lib/Connection' ;
3334import ConnectionPool , { ResurrectEvent } from './lib/ConnectionPool' ;
@@ -38,12 +39,18 @@ import * as errors from './lib/errors';
3839declare type anyObject = {
3940 [ key : string ] : any ;
4041} ;
41- declare type callbackFn = ( err : Error | null , result : ApiResponse ) => void ;
4242
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 ;
4754}
4855
4956// Extend API
@@ -315,5 +322,6 @@ export {
315322 RequestEvent ,
316323 ResurrectEvent ,
317324 RequestParams ,
325+ ClientOptions ,
318326 ClientExtendsCallbackOptions
319327} ;
0 commit comments