// Type definitions for request-promise v4.1.0 // Project: https://github.com/request/request-promise // Definitions by: Christopher Glantschnig , Joe Skeen , Aya Morisawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'request-promise' { import request = require('request'); import http = require('http'); import errors = require('request-promise/errors'); import Promise = require('bluebird'); namespace requestPromise { interface RequestPromise extends request.Request { then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; catch(onrejected?: (reason: any) => any | PromiseLike): Promise; catch(onrejected?: (reason: any) => void): 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: () => PromiseLike): Promise; finally(handler: () => TResult): 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; } export type OptionsWithUri = request.UriOptions & RequestPromiseOptions; export type OptionsWithUrl = request.UrlOptions & RequestPromiseOptions; export type Options = OptionsWithUri | OptionsWithUrl; } var requestPromise: request.RequestAPI; export = requestPromise; } declare module 'request-promise/errors' { import rp = require('request-promise'); import http = require('http'); export interface RequestError extends Error { cause: any; error: any; options: rp.Options; response: http.IncomingMessage; } export interface RequestErrorConstructor { new (cause: any, options: rp.Options, response: http.IncomingMessage): RequestError; (cause: any, options: rp.Options, response: http.IncomingMessage): RequestError; prototype: RequestError; } export const RequestError: RequestErrorConstructor; export interface StatusCodeError extends Error { statusCode: number; error: any; options: rp.Options; response: http.IncomingMessage; } export interface StatusCodeErrorConstructor extends Error { new (statusCode: number, body: any, options: rp.Options, response: http.IncomingMessage): StatusCodeError; (statusCode: number, body: any, options: rp.Options, response: http.IncomingMessage): StatusCodeError; prototype: StatusCodeError; } export const StatusCodeError: StatusCodeErrorConstructor; export interface TransformError extends Error { cause: any; error: any; options: rp.Options; response: http.IncomingMessage; } export interface TransformErrorConstructor extends Error { new (cause: any, options: rp.Options, response: http.IncomingMessage): TransformError; (cause: any, options: rp.Options, response: http.IncomingMessage): TransformError; prototype: TransformError; } export const TransformError: TransformErrorConstructor; }