-
Notifications
You must be signed in to change notification settings - Fork 92
/
request.d.ts
116 lines (101 loc) · 4.93 KB
/
request.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/// <reference path="node.d.ts" />
/// <reference path="form-data.d.ts" />
// https://github.com/mikeal/request
declare module "request" {
export = request;
import stream = require('stream');
import http = require('http');
import FormData = require('form-data');
import url = require('url');
function request(uri: string, options?: request.Options, callback?: (error: any, response: any, body: any) => void ): request.Request;
function request(uri: string, callback?: (error: any, response: any, body: any) => void ): request.Request;
function request(options: request.Options, callback?: (error: any, response: any, body: any) => void ): request.Request;
module request {
export function request(uri: string, options: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export var initParams;
export function defaults(options, requester);
export function forever(agentOptions, optionsArg);
export function jar(): CookieJar;
export function cookie(str: string): Cookie;
export function get(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export function get(uri: string, callback?: (error: any, response: any, body: any) => void ): Request;
export function get(options: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export function post(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export function post(uri: string, callback?: (error: any, response: any, body: any) => void ): Request;
export function post(options: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export function put(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export function put(uri: string, callback?: (error: any, response: any, body: any) => void ): Request;
export function put(options: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export function head(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export function head(uri: string, callback?: (error: any, response: any, body: any) => void ): Request;
export function head(options: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export function del(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void ): Request;
export function del(uri: string, callback?: (error: any, response: any, body: any) => void ): Request;
export function del(options: Options, callback?: (error: any, response: any, body: any) => void ): Request;
interface Options {
uri?: string;
callback?: (error: any, response: any, body: any) => void;
jar?;
form?;
oauth?;
aws?;
qs?;
json?;
multipart?;
ca?;
agentOptions?;
agentClass?;
forever?;
requestBodyStream?;
host?;
port?;
method?;
headers?;
body?;
followRedirect?;
followAllRedirects?;
maxRedirects?;
encoding?;
pool?;
timeout?;
proxy?;
strictSSL?;
}
interface Request {
// _updateProtocol();
getAgent(): http.Agent;
//start();
//abort();
pipeDest(dest);
setHeader(name: string, value: string, clobber?: boolean): Request;
setHeaders(headers: any): Request;
qs(q: any, clobber?: boolean): Request;
form(form: any): FormData.FormData;
multipart(multipart: { body: any; }[]): Request;
json(val: any): Request;
aws(opts, now): Request;
oauth(oauth): Request;
jar(jar): Request;
pipe(dest: stream.WritableStream, opts: any): stream.WritableStream;
write();
end(chunk);
pause();
resume();
abort();
destroy();
toJSON(): string;
}
export interface CookieJar {
setCookie(cookie: Cookie, uri: string|url.Url, options?: any): void
getCookieString(uri: string|url.Url)
getCookies(uri: string|url.Url)
}
export interface Cookie extends Array<{ name; value; httpOnly; }> {
constructor(str, req);
str: string;
expires: Date;
path: string;
toString(): string;
}
}
}