-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
59 lines (59 loc) · 2.23 KB
/
index.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
/// <reference types="node" />
/// <reference types="node" />
declare class FetchBuilder {
private readonly request;
static JsonError: typeof JsonError;
static buildUrl(strings: TemplateStringsArray, ...p: any[]): string;
static get(url: any): FetchBuilder;
static put(url: any): FetchBuilder;
static post(url: any): FetchBuilder;
static delete(url: any): FetchBuilder;
static url(url: string): FetchBuilder;
static header(name: string, value: string): FetchBuilder;
static method(url: any, method: string): FetchBuilder;
private constructor();
log(logger: (...a: any[]) => void): FetchBuilder;
logWhenFailed(logger: (...a: any[]) => void): FetchBuilder;
get(url: any): FetchBuilder;
put(url: any): FetchBuilder;
post(url: any): FetchBuilder;
delete(url: any): FetchBuilder;
method(url: string, method: string): FetchBuilder;
signal(signal: AbortSignal): FetchBuilder;
form(name: string, value: string): FetchBuilder;
form(name: string, value: Blob, fileName: string): FetchBuilder;
jsonBody(body: any, encode?: boolean): FetchBuilder;
header(name: string, value: string): FetchBuilder;
path(name: string, value: any, encode?: boolean): FetchBuilder;
query(name: string, value: any, encode?: boolean): FetchBuilder;
asText(ensureSuccess?: boolean): Promise<string>;
asBlob(ensureSuccess?: boolean): Promise<import("buffer").Blob>;
asJson<T = any>(ensureSuccess?: boolean): Promise<T>;
asJsonResponse<T = any>(ensureSuccess?: boolean): Promise<{
result: T;
headers: any;
status: number;
}>;
asTextResponse(ensureSuccess?: boolean): Promise<{
result: Promise<string>;
headers: any;
status: number;
}>;
asBlobResponse(ensureSuccess?: boolean): Promise<{
result: Promise<import("buffer").Blob>;
headers: any;
status: number;
}>;
execute<T>(ensureSuccess: boolean, postProcessor: (r: Response) => T): Promise<{
result: T;
headers: any;
status: number;
}>;
private append;
}
declare class JsonError extends Error {
readonly json: any;
constructor(message: any, json: any);
}
export = FetchBuilder;
//# sourceMappingURL=index.d.ts.map