1 | import request = require("request");
|
2 | import http = require("http");
|
3 | import errors = require("./errors");
|
4 | import Promise = require("bluebird");
|
5 |
|
6 | declare namespace requestPromise {
|
7 | interface RequestPromise<T = any> extends request.Request {
|
8 | then: Promise<T>["then"];
|
9 | catch: Promise<T>["catch"];
|
10 | finally: Promise<T>["finally"];
|
11 | cancel: Promise<T>["cancel"];
|
12 | promise(): Promise<T>;
|
13 | }
|
14 |
|
15 | interface RequestPromiseOptions extends request.CoreOptions {
|
16 | simple?: boolean | undefined;
|
17 | transform?(body: any, response: request.Response, resolveWithFullResponse?: boolean): any;
|
18 | transform2xxOnly?: boolean | undefined;
|
19 | resolveWithFullResponse?: boolean | undefined;
|
20 | }
|
21 |
|
22 | type RequestPromiseAPI<T = any> = request.RequestAPI<
|
23 | RequestPromise<T>,
|
24 | RequestPromiseOptions,
|
25 | request.RequiredUriUrl
|
26 | >;
|
27 | type OptionsWithUri = request.UriOptions & RequestPromiseOptions;
|
28 | type OptionsWithUrl = request.UrlOptions & RequestPromiseOptions;
|
29 | type Options = OptionsWithUri | OptionsWithUrl;
|
30 | }
|
31 |
|
32 | declare const requestPromise: requestPromise.RequestPromiseAPI;
|
33 | export = requestPromise;
|