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

Commit

Permalink
feat(domain): options api addition
Browse files Browse the repository at this point in the history
  • Loading branch information
Ganesh Kumar committed Aug 2, 2019
1 parent 2440316 commit c33b673
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api/domain/domain.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ angular.module("ovh-api-services").service("OvhApiDomain", function ($injector)
},
Rules: function () {
return $injector.get("OvhApiDomainRules");
},
Options: function () {
return $injector.get("OvhApiDomainOptions");
}
};
});
8 changes: 8 additions & 0 deletions src/api/domain/options/domain-options.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module("ovh-api-services").service("OvhApiDomainOptions", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiDomainOptionsV6");
}
};
});
37 changes: 37 additions & 0 deletions src/api/domain/options/domain-options.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
angular.module("ovh-api-services").service("OvhApiDomainOptionsV6", function ($resource, $cacheFactory) {
"use strict";

var queryCache = $cacheFactory("OvhApiDomainOptionsV6Query");
var cache = $cacheFactory("OvhApiDomainOptionsV6");

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

var domainOptions = $resource("/domain/:serviceName/option/:option", {
serviceName: "@serviceName",
option: "@option"
}, {
query: {
method: "GET",
cache: queryCache,
isArray: true
},
get: { method: "GET", cache: cache },
"delete": { method: "DELETE", interceptor: interceptor }
});

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

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

return domainOptions;
});

0 comments on commit c33b673

Please sign in to comment.