forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs-data-http.d.ts
46 lines (38 loc) · 1.77 KB
/
js-data-http.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
// Type definitions for JSData Http Adapter v1.2.0
// Project: https://github.com/js-data/js-data-http
// Definitions by: Stefan Steinhart <https://github.com/reppners>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../js-data/js-data.d.ts" />
declare module JSData {
interface DSHttpAdapterOptions {
serialize?: (resourceName:string, data:any)=>any;
deserialize?: (resourceName:string, data:any)=>any;
queryTransform?: (resourceName:string, params:DSFilterParams)=>any;
httpConfig?: any;
forceTrailingSlash?: boolean;
log?: any;
// TODO wait for union types to be supported
// log: (message?: any, ...optionalParams: any[])=> void;
// log: boolean;
error?: any;
// TODO wait for union types to be supported
// error: (message?: any, ...optionalParams: any[])=> void;
// error: boolean;
}
interface DSHttpAdapterPromiseResolveType {
data: any;
headers: any;
status: number;
config: any;
}
interface DSHttpAdapter extends IDSAdapter {
new(options?:DSHttpAdapterOptions):DSHttpAdapter;
// DSHttpAdapter uses axios so options are axios config objects.
HTTP(options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
DEL(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
GET(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
POST(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
PUT(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
}
}
declare var DSHttpAdapter:JSData.DSHttpAdapter;