1 | export declare type RequestType = "post" | "get" | "jsonp";
|
2 | export declare type ResponseType = "json" | "text";
|
3 | export declare type IOptionsSend = (options: IOptions, action: string, request: any, responseType: ResponseType, defaultSend: SendFunc, header?: any) => Promise<any>;
|
4 | export interface IOptions {
|
5 | baseUrl: string;
|
6 | type?: RequestType;
|
7 | userID?: string;
|
8 | password?: string;
|
9 | rejectUnauthorized?: boolean;
|
10 | timeoutSecs?: number;
|
11 | hookSend?: IOptionsSend;
|
12 | encodeRequest?: boolean;
|
13 | }
|
14 | export declare function instanceOfIOptions(object: any): object is IOptions;
|
15 | export interface IConnection {
|
16 | opts(_: Partial<IOptions>): this;
|
17 | opts(): IOptions;
|
18 | baseUrl: string;
|
19 | send(action: string, request: any, responseType?: ResponseType): Promise<any>;
|
20 | clone(): IConnection;
|
21 | }
|
22 | export declare function instanceOfIConnection(object: any): object is IConnection;
|
23 | export declare function serializeRequest(obj: any, encodeRequest?: boolean, prefix?: string): string;
|
24 | export declare function deserializeResponse(body: string): any;
|
25 | export declare function jsonp(opts: IOptions, action: string, request?: any, responseType?: ResponseType, header?: any): Promise<any>;
|
26 | export declare function post(opts: IOptions, action: string, request: any, responseType?: ResponseType, header?: any): Promise<any>;
|
27 | export declare function get(opts: IOptions, action: string, request: any, responseType?: ResponseType, header?: any): Promise<any>;
|
28 | export declare type SendFunc = (opts: IOptions, action: string, request: any, responseType: ResponseType, header?: any) => Promise<any>;
|
29 | export declare function send(opts: IOptions, action: string, request: any, responseType?: ResponseType, header?: any): Promise<any>;
|
30 | export declare function hookSend(newSend?: SendFunc): SendFunc;
|
31 | export declare class Connection implements IConnection {
|
32 | protected _opts: IOptions;
|
33 | get baseUrl(): string;
|
34 | constructor(opts: IOptions);
|
35 | opts(_: Partial<IOptions>): this;
|
36 | opts(): IOptions;
|
37 | send(action: string, request: any, responseType?: ResponseType, header?: any): Promise<any>;
|
38 | clone(): Connection;
|
39 | }
|
40 | export declare type IConnectionFactory = (opts: IOptions) => IConnection;
|
41 | export declare let createConnection: IConnectionFactory;
|
42 | export declare function setTransportFactory(newFunc: IConnectionFactory): IConnectionFactory;
|
43 | //# sourceMappingURL=connection.d.ts.map |
\ | No newline at end of file |