diff --git a/src/api/domain/domain.service.js b/src/api/domain/domain.service.js index 19b8bdc3..952d7210 100644 --- a/src/api/domain/domain.service.js +++ b/src/api/domain/domain.service.js @@ -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"); } }; }); diff --git a/src/api/domain/options/domain-options.service.js b/src/api/domain/options/domain-options.service.js new file mode 100644 index 00000000..88c57bca --- /dev/null +++ b/src/api/domain/options/domain-options.service.js @@ -0,0 +1,8 @@ +angular.module("ovh-api-services").service("OvhApiDomainOptions", function ($injector) { + "use strict"; + return { + v6: function () { + return $injector.get("OvhApiDomainOptionsV6"); + } + }; +}); diff --git a/src/api/domain/options/domain-options.v6.service.js b/src/api/domain/options/domain-options.v6.service.js new file mode 100644 index 00000000..8672ef19 --- /dev/null +++ b/src/api/domain/options/domain-options.v6.service.js @@ -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; +});