-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
38 lines (28 loc) · 1 KB
/
types.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
import type { RequestInitWithRetry } from 'fetch-retry';
declare type headers = {
[key: string]: string
};
export class APIClient {
public static CONTENT_TYPE: {
JSON: 'application/json',
FORM_URL_ENCODED: 'application/x-www-form-urlencoded',
};
constructor(initOpts?: {
host?: string;
contentType?: 'application/json' | 'application/x-www-form-urlencoded';
headers?: headers;
payloadSignMethod?: (body: any) => any;
retryOpts?: RequestInitWithRetry;
});
public get(path: string, headers?: headers): Promise<any>;
public post(path: string, body?: any, headers?: headers): Promise<any>;
public patch(path: string, body?: any, headers?: headers): Promise<any>;
public put(path: string, body?: any, headers?: headers): Promise<any>;
public del(path: string, body?: any, headers?: headers): Promise<any>;
}
export class APIResponseError extends Error {
public status: number;
public statusText: string;
public body: any;
}
export class NetworkError extends Error {}