-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.js
More file actions
34 lines (32 loc) · 775 Bytes
/
Copy pathclient.js
File metadata and controls
34 lines (32 loc) · 775 Bytes
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
/**
* OpenStack client in Javascript.
* mds900 20150703
*/
if (typeof(osclient) === "undefined") {
osclient = {};
}
/**
* Abstract base class client for generic OpenStack HTTP APIs.
*/
osclient.Client = function() {
};
$.extend(osclient.Client.prototype, {
defaultParams: {
error: function(jqxhr, status, err) {
console.log(jqxhr, status, err);
},
contentType: "application/json",
dataType: "json",
method: "GET",
type: "GET"
},
doRequest: function(extraParams) {
if ("method" in extraParams && !("type" in extraParams)) {
extraParams.type = extraParams.method;
}
if ("type" in extraParams && !("method" in extraParams)) {
extraParams.method = extraParams.type;
}
return $.ajax($.extend({}, this.defaultParams, extraParams));
}
});