-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
29 lines (24 loc) · 1.07 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
import {connection} from "@sekizlipenguen/connection";
declare module "@sekizlipenguen/connection" {
export interface Config {
connectType?: 'fetch' | 'xhr';
headers?: Record<string, string>;
timeout?: number;
progress?: (event: ProgressEvent) => void;
}
export interface ReturnTypeConfig<T = any> {
data?: T;
request?: XMLHttpRequest | Response;
statusCode?: number;
}
export interface connection {
get: <T = any>(url: string, config?: Config) => Promise<ReturnTypeConfig<T>>;
post: <T = any>(url: string, data?: object, config?: Config) => Promise<ReturnTypeConfig<T>>;
put: <T = any>(url: string, data?: object, config?: Config) => Promise<ReturnTypeConfig<T>>;
patch: <T = any>(url: string, data?: object, config?: Config) => Promise<ReturnTypeConfig<T>>;
delete: <T = any>(url: string, data?: object, config?: Config) => Promise<ReturnTypeConfig<T>>;
setConfig: (config: Config) => void;
}
export const connection: connection;
}
export default connection;