// Type definitions for request-promise 4.1 // Project: https://github.com/request/request-promise // Definitions by: Christopher Glantschnig , Joe Skeen , Aya Morisawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import request = require('request'); import http = require('http'); import errors = require('request-promise/errors'); import Promise = require('bluebird'); declare namespace requestPromise { interface RequestPromise extends request.Request { then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => void | TResult | PromiseLike): Promise; catch(onrejected?: (reason: any) => any | PromiseLike): Promise; catch(type: errors.RequestErrorConstructor, onrejected?: (reason: errors.RequestError) => void): Promise; catch(type: errors.StatusCodeErrorConstructor, onrejected?: (reason: errors.StatusCodeError) => void): Promise; catch(type: errors.TransformErrorConstructor, onrejected?: (reason: errors.TransformError) => void): Promise; finally(handler: () => TResult | PromiseLike): Promise; promise(): Promise; cancel(): void; } interface RequestPromiseOptions extends request.CoreOptions { simple?: boolean; transform?(body: any, response: http.IncomingMessage, resolveWithFullResponse?: boolean): any; transform2xxOnly?: boolean; resolveWithFullResponse?: boolean; } type OptionsWithUri = request.UriOptions & RequestPromiseOptions; type OptionsWithUrl = request.UrlOptions & RequestPromiseOptions; type Options = OptionsWithUri | OptionsWithUrl; } declare var requestPromise: request.RequestAPI; export = requestPromise;