2019-05-15 01:48:48 +03:00
|
|
|
export declare type ConnectionInfo = {
|
|
|
|
url: string;
|
2020-07-14 09:33:30 +03:00
|
|
|
headers?: {
|
|
|
|
[key: string]: string | number;
|
|
|
|
};
|
2019-05-15 01:48:48 +03:00
|
|
|
user?: string;
|
|
|
|
password?: string;
|
2019-06-12 08:01:04 +03:00
|
|
|
allowInsecureAuthentication?: boolean;
|
2019-11-23 15:38:13 +03:00
|
|
|
throttleLimit?: number;
|
2020-07-14 09:33:30 +03:00
|
|
|
throttleCallback?: (attempt: number, url: string) => Promise<boolean>;
|
2019-05-15 01:48:48 +03:00
|
|
|
timeout?: number;
|
|
|
|
};
|
|
|
|
export interface OnceBlockable {
|
|
|
|
once(eventName: "block", handler: () => void): void;
|
|
|
|
}
|
2020-05-05 06:01:04 +03:00
|
|
|
export interface OncePollable {
|
|
|
|
once(eventName: "poll", handler: () => void): void;
|
|
|
|
}
|
2019-05-15 01:48:48 +03:00
|
|
|
export declare type PollOptions = {
|
|
|
|
timeout?: number;
|
|
|
|
floor?: number;
|
|
|
|
ceiling?: number;
|
|
|
|
interval?: number;
|
|
|
|
retryLimit?: number;
|
|
|
|
onceBlock?: OnceBlockable;
|
2020-05-05 06:01:04 +03:00
|
|
|
oncePoll?: OncePollable;
|
2019-05-15 01:48:48 +03:00
|
|
|
};
|
2019-09-28 09:36:19 +03:00
|
|
|
export declare type FetchJsonResponse = {
|
|
|
|
statusCode: number;
|
|
|
|
headers: {
|
|
|
|
[header: string]: string;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
export declare function fetchJson(connection: string | ConnectionInfo, json?: string, processFunc?: (value: any, response: FetchJsonResponse) => any): Promise<any>;
|
2020-05-21 07:07:41 +03:00
|
|
|
export declare function poll<T>(func: () => Promise<T>, options?: PollOptions): Promise<T>;
|