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

Commit

Permalink
feat(xdsl.meetings): add endpoints to retrieve and select meeting
Browse files Browse the repository at this point in the history
Signed-off-by: Stephanie Moallic <[email protected]>
  • Loading branch information
Stephanie Moallic committed Aug 4, 2020
1 parent d37f01d commit 85fec79
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/api/xdsl/meeting/xdsl-meeting.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
angular.module('ovh-api-services').service('OvhApiXdslMeeting', ($injector, $cacheFactory) => {
const cache = $cacheFactory('OvhApiXdslMeeting');

return {
v6() {
return $injector.get('OvhApiXdslMeetingV6');
},
resetCache: cache.removeAll,
cache,
};
});
44 changes: 44 additions & 0 deletions src/api/xdsl/meeting/xdsl-meeting.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
angular.module('ovh-api-services').service('OvhApiXdslMeetingV6', ($resource, OvhApiXdslMeeting, Poller) => {
const interceptor = {
response(response) {
OvhApiXdslMeeting.resetCache();
return response.resource;
},
};

const meeting = $resource('/xdsl/:serviceName/orderMeeting', {
serviceName: '@serviceName',
}, {
orderMeeting: {
method: 'POST',
interceptor,
},
});

meeting.searchOrderMeetings = function ($scope, opts) {
const url = `/xdsl/${opts.serviceName}/searchOrderMeetings`;

$scope.$on('$destroy', () => {
Poller.kill({
scope: $scope.$id,
});
});

return Poller.poll(
url,
null,
{
successRule: {
status(elem) {
return elem.status === 'error' || elem.status === 'ok';
},
},
scope: $scope.$id,
method: 'POST',
retryMaxAttempts: 3,
},
);
};

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

0 comments on commit 85fec79

Please sign in to comment.