forked from PartyGodTroy/Vue.hx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VueResource.hx
47 lines (43 loc) · 1.71 KB
/
VueResource.hx
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
package vue;
/**
* vue-resource
* The plugin for Vue.js provides services for making web requests
* and handle responses using a XMLHttpRequest or JSONP.
*
* @source https://github.com/pagekit/vue-resource
*/
@:native("Vue.http")
extern class VueResource {
public static function get(url:String, ?options:RequestOptions):js.lib.Promise<Dynamic>;
public static function head(url:String, ?options:RequestOptions):js.lib.Promise<Dynamic>;
public static function delete(url:String, ?options:RequestOptions):js.lib.Promise<Dynamic>;
public static function jsonp(url:String, ?options:RequestOptions):js.lib.Promise<Dynamic>;
public static function post(url:String, ?body:Dynamic, ?options:RequestOptions):js.lib.Promise<Dynamic>;
public static function put(url:String, ?body:Dynamic, ?options:RequestOptions):js.lib.Promise<Dynamic>;
public static function patch(url:String, ?body:Dynamic, ?options:RequestOptions):js.lib.Promise<Dynamic>;
}
typedef RequestOptions = {
@:optional var url:String;
@:optional var body:Dynamic;
@:optional var headers:Dynamic;
@:optional var params:Dynamic;
@:optional var method:String;
@:optional var responseType:String;
@:optional var timeout:Int;
@:optional var before:RequestOptions->Void;
@:optional var progress:js.html.Event->Void;
@:optional var credentials:Bool;
@:optional var emulateHTTP:Bool;
@:optional var emulateJSON:Bool;
}
typedef Response = {
@:optional var url:String;
@:optional var body:Dynamic;
@:optional var headers:Dynamic;
@:optional var ok:Bool;
@:optional var status:Int;
@:optional var statusText:String;
@:optional var text:Void->js.lib.Promise<Dynamic>;
@:optional var json:Void->js.lib.Promise<Dynamic>;
@:optional var blob:Void->js.lib.Promise<Dynamic>;
}