Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
feat(me api): add application and credential api bindings (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
antleblanc authored Apr 20, 2018
1 parent 42943a5 commit 7091b82
Show file tree
Hide file tree
Showing 9 changed files with 346 additions and 10 deletions.
171 changes: 171 additions & 0 deletions dist/ovh-api-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -6505,6 +6505,174 @@ angular.module("ovh-api-services").service("OvhApiMeAlerts", ["$injector", funct
};
}]);

angular.module("ovh-api-services").service("OvhApiMeApiApplication", ["$injector", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiMeApiApplicationV6");
}
};

}]);

angular.module("ovh-api-services").service("OvhApiMeApiApplicationV6", ["$cacheFactory", "$resource", function ($cacheFactory, $resource) {
"use strict";

var queryCache = $cacheFactory("OvhApiMeApiApplicationV6Query");
var cache = $cacheFactory("OvhApiMeApiApplicationV6");
var batchCache = $cacheFactory("OvhApiMeApiApplicationV6Batch");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.data;
}
};

var resource = $resource("/me/api/application/:applicationId", {
applicationId: "@applicationId"
}, {
query: {
method: "GET",
isArray: true,
cache: queryCache
},
get: {
method: "GET",
cache: cache
},
getBatch: {
method: "GET",
isArray: true,
cache: batchCache,
headers: {
"X-Ovh-Batch": ","
}
},
"delete": {
method: "POST",
interceptor: interceptor
}
});

resource.resetQueryCache = function () {
queryCache.removeAll();
};

resource.resetCache = function () {
cache.removeAll();
};

resource.resetBatchCache = function () {
batchCache.removeAll();
};

resource.resetAllCache = function () {
this.resetQueryCache();
this.resetCache();
this.resetBatchCache();
};

return resource;
}]);

angular.module("ovh-api-services").service("OvhApiMeApiCredential", ["$injector", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiMeApiCredentialV6");
}
};

}]);

angular.module("ovh-api-services").service("OvhApiMeApiCredentialV6", ["$cacheFactory", "$resource", function ($cacheFactory, $resource) {
"use strict";

var queryCache = $cacheFactory("OvhApiMeApiCredentialV6Query");
var cache = $cacheFactory("OvhApiMeApiCredentialV6");
var batchCache = $cacheFactory("OvhApiMeApiCredentialV6Batch");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.data;
}
};

var resource = $resource("/me/api/credential/:credentialId", {
credentialId: "@credentialId"
}, {
query: {
method: "GET",
isArray: true,
cache: queryCache
},
get: {
method: "GET",
cache: cache
},
getBatch: {
method: "GET",
isArray: true,
cache: batchCache,
headers: {
"X-Ovh-Batch": ","
}
},
"delete": {
method: "DELETE",
interceptor: interceptor
},
application: {
method: "GET",
url: "/me/api/credential/:credentialId/application",
cache: cache,
params: {
credentialId: "@credentialId"
}
}
});

resource.resetQueryCache = function () {
queryCache.removeAll();
};

resource.resetCache = function () {
cache.removeAll();
};

resource.resetBatchCache = function () {
batchCache.removeAll();
};

resource.resetAllCache = function () {
this.resetQueryCache();
this.resetCache();
this.resetBatchCache();
};

return resource;
}]);

angular.module("ovh-api-services").service("OvhApiMeApi", ["$injector", function ($injector) {
"use strict";

return {
Application: function () {
return $injector.get("OvhApiMeApiApplication");
},
Credential: function () {
return $injector.get("OvhApiMeApiCredential");
}
};

}]);

angular.module("ovh-api-services").service("OvhApiMeAvailableAutomaticPaymentMeans", ["$injector", function ($injector) {
"use strict";

Expand Down Expand Up @@ -6875,6 +7043,9 @@ angular.module("ovh-api-services").service("OvhApiMe", ["$injector", function ($
v6: function () {
return $injector.get("OvhApiMeV6");
},
Api: function () {
return $injector.get("OvhApiMeApi");
},
Agreements: function () {
return $injector.get("OvhApiMeAgreements");
},
Expand Down
17 changes: 8 additions & 9 deletions dist/ovh-api-services.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/me/api/application/me-api-application.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
angular.module("ovh-api-services").service("OvhApiMeApiApplication", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiMeApiApplicationV6");
}
};

});
61 changes: 61 additions & 0 deletions src/me/api/application/me-api-application.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
angular.module("ovh-api-services").service("OvhApiMeApiApplicationV6", function ($cacheFactory, $resource) {
"use strict";

var queryCache = $cacheFactory("OvhApiMeApiApplicationV6Query");
var cache = $cacheFactory("OvhApiMeApiApplicationV6");
var batchCache = $cacheFactory("OvhApiMeApiApplicationV6Batch");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.data;
}
};

var resource = $resource("/me/api/application/:applicationId", {
applicationId: "@applicationId"
}, {
query: {
method: "GET",
isArray: true,
cache: queryCache
},
get: {
method: "GET",
cache: cache
},
getBatch: {
method: "GET",
isArray: true,
cache: batchCache,
headers: {
"X-Ovh-Batch": ","
}
},
"delete": {
method: "POST",
interceptor: interceptor
}
});

resource.resetQueryCache = function () {
queryCache.removeAll();
};

resource.resetCache = function () {
cache.removeAll();
};

resource.resetBatchCache = function () {
batchCache.removeAll();
};

resource.resetAllCache = function () {
this.resetQueryCache();
this.resetCache();
this.resetBatchCache();
};

return resource;
});
10 changes: 10 additions & 0 deletions src/me/api/credential/me-api-credential.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
angular.module("ovh-api-services").service("OvhApiMeApiCredential", function ($injector) {
"use strict";

return {
v6: function () {
return $injector.get("OvhApiMeApiCredentialV6");
}
};

});
69 changes: 69 additions & 0 deletions src/me/api/credential/me-api-credential.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
angular.module("ovh-api-services").service("OvhApiMeApiCredentialV6", function ($cacheFactory, $resource) {
"use strict";

var queryCache = $cacheFactory("OvhApiMeApiCredentialV6Query");
var cache = $cacheFactory("OvhApiMeApiCredentialV6");
var batchCache = $cacheFactory("OvhApiMeApiCredentialV6Batch");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.data;
}
};

var resource = $resource("/me/api/credential/:credentialId", {
credentialId: "@credentialId"
}, {
query: {
method: "GET",
isArray: true,
cache: queryCache
},
get: {
method: "GET",
cache: cache
},
getBatch: {
method: "GET",
isArray: true,
cache: batchCache,
headers: {
"X-Ovh-Batch": ","
}
},
"delete": {
method: "DELETE",
interceptor: interceptor
},
application: {
method: "GET",
url: "/me/api/credential/:credentialId/application",
cache: cache,
params: {
credentialId: "@credentialId"
}
}
});

resource.resetQueryCache = function () {
queryCache.removeAll();
};

resource.resetCache = function () {
cache.removeAll();
};

resource.resetBatchCache = function () {
batchCache.removeAll();
};

resource.resetAllCache = function () {
this.resetQueryCache();
this.resetCache();
this.resetBatchCache();
};

return resource;
});
13 changes: 13 additions & 0 deletions src/me/api/me-api.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
angular.module("ovh-api-services").service("OvhApiMeApi", function ($injector) {
"use strict";

return {
Application: function () {
return $injector.get("OvhApiMeApiApplication");
},
Credential: function () {
return $injector.get("OvhApiMeApiCredential");
}
};

});
3 changes: 3 additions & 0 deletions src/me/me.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ angular.module("ovh-api-services").service("OvhApiMe", function ($injector) {
v6: function () {
return $injector.get("OvhApiMeV6");
},
Api: function () {
return $injector.get("OvhApiMeApi");
},
Agreements: function () {
return $injector.get("OvhApiMeAgreements");
},
Expand Down

0 comments on commit 7091b82

Please sign in to comment.