-
-
Notifications
You must be signed in to change notification settings - Fork 421
/
interfaces.ts
53 lines (47 loc) · 1.22 KB
/
interfaces.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
export interface Attachment {
name: string;
path?: string;
filename?: string;
}
export interface RequestOptions {
url: string;
method?: string;
query?: Object;
send?: Object;
headers?: Object;
accept?: string;
type?: string;
user?: string;
password?: string;
field?: Object;
progress?: boolean;
attach?: Array<Attachment>;
withCredentials?: boolean;
redirects?: number;
category?: string;
lazy?: boolean;
_error?: any;
_namespace?: Array<string>;
}
export type RequestInput = RequestOptions | string;
export interface ResponseStream {
request: RequestOptions;
}
export interface Response {
text?: string;
body?: Object;
header?: Object;
type?: string;
status?: number;
request?: RequestOptions;
}
// Just to give a name to the type, to express intent, we create GenericStream.
// We are supposed to use TypeScript Declaration Merging over the HTTPSource
// to replace GenericStream with a specific stream type, e.g. Observable or
// Stream, depending on the stream library used.
export type GenericStream = any;
export interface HTTPSource {
response$$: GenericStream;
filter(predicate: (response$: ResponseStream) => boolean): HTTPSource;
select(category: string): GenericStream;
}