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

feat(xdsl.exchange): add rma call api #219

Merged
merged 7 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/api/xdsl/rma/xdsl-rma.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiXdslRMA', $injector => ({
v6() {
return $injector.get('OvhApiXdslRMAV6');
},
}));
41 changes: 41 additions & 0 deletions src/api/xdsl/rma/xdsl-rma.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
angular.module('ovh-api-services').service('OvhApiXdslRMAV6', ($resource, $cacheFactory) => {
const cache = $cacheFactory('OvhApiXdslRMAV6');
const queryCache = $cacheFactory('OvhApiXdslRMAV6Query');

const interceptor = {
response(response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.resource;
},
};

const resource = $resource('/xdsl/:xdslId/rma/:id', {
xdslId: '@xdslId',
id: '@id',
}, {
query: {
method: 'GET',
isArray: true,
cache: queryCache,
},
get: {
method: 'GET',
},
update: {
method: 'PUT',
interceptor,
},
delete: {
method: 'DELETE',
interceptor,
},
});

resource.resetAllCache = function () {
cache.removeAll();
queryCache.removeAll();
};

return resource;
});
3 changes: 3 additions & 0 deletions src/api/xdsl/xdsl.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ angular.module('ovh-api-services').service('OvhApiXdsl', ($injector, $cacheFacto
Spare() {
return $injector.get('OvhApiXdslSpare');
},
RMA() {
return $injector.get('OvhApiXdslRMA');
},
resetCache: cache.removeAll,
cache,
};
Expand Down