-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
rest.ts
41 lines (36 loc) · 927 Bytes
/
rest.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
import { HttpHeaders, HttpParameterCodec, HttpParams } from '@angular/common/http';
export namespace Rest {
export type Config = Partial<{
apiName: string;
skipHandleError: boolean;
skipAddingHeader: boolean;
observe: Observe;
httpParamEncoder?: HttpParameterCodec;
}>;
export const enum Observe {
Body = 'body',
Events = 'events',
Response = 'response',
}
export const enum ResponseType {
ArrayBuffer = 'arraybuffer',
Blob = 'blob',
JSON = 'json',
Text = 'text',
}
export type Params = HttpParams | { [param: string]: any };
export interface Request<T> {
body?: T;
headers?:
| HttpHeaders
| {
[header: string]: string | string[];
};
method: string;
params?: Params;
reportProgress?: boolean;
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
url: string;
withCredentials?: boolean;
}
}