mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-29 00:51:29 +08:00
* Always use forceConsistentCasingInFileNames * Rename files * Convert more packages to `types-2.0` style
32 lines
1.5 KiB
TypeScript
32 lines
1.5 KiB
TypeScript
// Type definitions for request-promise-native v1.0.3
|
|
// Project: https://github.com/request/request-promise-native
|
|
// Definitions by: Gustavo Henke <https://github.com/gustavohenke>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
import request = require('request');
|
|
import http = require('http');
|
|
|
|
declare namespace requestPromise {
|
|
interface RequestPromise extends request.Request {
|
|
then<TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
|
then<TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
|
catch(onrejected?: (reason: any) => any | PromiseLike<any>): Promise<any>;
|
|
catch(onrejected?: (reason: any) => void): Promise<any>;
|
|
promise(): Promise<any>;
|
|
cancel(): void;
|
|
}
|
|
|
|
interface RequestPromiseOptions extends request.CoreOptions {
|
|
simple?: boolean;
|
|
transform?: (body: any, response: http.IncomingMessage, resolveWithFullResponse?: boolean) => any;
|
|
resolveWithFullResponse?: boolean;
|
|
}
|
|
|
|
export type OptionsWithUri = request.UriOptions & RequestPromiseOptions;
|
|
export type OptionsWithUrl = request.UrlOptions & RequestPromiseOptions;
|
|
export type Options = OptionsWithUri | OptionsWithUrl;
|
|
}
|
|
|
|
declare var requestPromise: request.RequestAPI<requestPromise.RequestPromise, requestPromise.RequestPromiseOptions, request.RequiredUriUrl>;
|
|
export = requestPromise;
|