-
-
Notifications
You must be signed in to change notification settings - Fork 421
/
interfaces.ts
54 lines (47 loc) · 1.29 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
54
import {Stream, MemoryStream} from 'xstream';
import {Response as SuperagentResponse} from 'superagent';
export interface Attachment {
name: string;
path?: string;
filename?: string;
}
export interface AgentOptions {
key: string;
cert: 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>;
agent?: AgentOptions;
withCredentials?: boolean;
redirects?: number;
category?: string;
lazy?: boolean;
responseType?: string;
_error?: any;
_namespace?: Array<string>;
}
export type RequestInput = RequestOptions | string;
export interface ResponseStream {
request: RequestOptions;
}
export interface Response extends SuperagentResponse {
total?: number; // Not sure what is this. Stays here to avoid breaking change
request: RequestOptions;
}
export interface HTTPSource {
filter(predicate: (request: RequestOptions) => boolean): HTTPSource;
select(category?: string): Stream<MemoryStream<Response> & ResponseStream>;
isolateSource(source: HTTPSource, scope: string): HTTPSource;
isolateSink(sink: Stream<RequestInput>, scope: string): Stream<RequestInput>;
}