forked from soywiz-archive/typescript-node-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.d.ts
More file actions
98 lines (85 loc) · 3.5 KB
/
request.d.ts
File metadata and controls
98 lines (85 loc) · 3.5 KB
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
/// <reference path="node.d.ts" />
/// <reference path="form-data.d.ts" />
// https://github.com/mikeal/request
declare module "request" {
export import request = module('request');
export import stream = module('stream');
export import http = module('http');
export import FormData = module('form-data');
export function(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request;
export function(uri: string, callback?: (error: any, response: any, body: any) => void): Request;
export function(options: Options, callback?: (error: any, response: any, body: any) => void): 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 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?;
}
interface Request {
// _updateProtocol();
getAgent(): http.Agent;
//start();
//abort();
pipeDest(dest);
setHeader(name: string, value: string, clobber?: bool): Request;
setHeaders(headers: any): Request;
qs(q: any, clobber?: bool): 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();
destroy();
toJSON(): string;
}
//stream.
export interface CookieJar {
add(cookie: Cookie): void;
get(req): Cookie;
cookieString(req): string;
}
export interface Cookie {
constructor (str, req);
str: string;
expires: Date;
path: string;
[index: string]: { name; value; httpOnly; };
toString(): string;
}
}