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

feat(xdsl.meetings): add endpoints to retrieve and select meeting #302

Merged
merged 2 commits into from
Aug 6, 2020
Merged
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
37 changes: 35 additions & 2 deletions src/api/xdsl/xdsl.v6.service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('ovh-api-services').service('OvhApiXdslV6', ($resource, OvhApiXdsl, OvhApiTelecomSidebar) => {
angular.module('ovh-api-services').service('OvhApiXdslV6', ($resource, OvhApiXdsl, OvhApiTelecomSidebar, Poller) => {
const interceptor = {
response(response) {
OvhApiTelecomSidebar.resetCache();
Expand All @@ -7,9 +7,10 @@ angular.module('ovh-api-services').service('OvhApiXdslV6', ($resource, OvhApiXds
},
};

return $resource(
const xdsl = $resource(
'/xdsl/:xdslId', {
xdslId: '@id',
serviceName: '@serviceName',
}, {
query: {
method: 'GET',
Expand Down Expand Up @@ -82,6 +83,38 @@ angular.module('ovh-api-services').service('OvhApiXdslV6', ($resource, OvhApiXds
method: 'POST',
url: '/xdsl/:xdslId/applyTemplateToModem',
},
orderMeeting: {
method: 'POST',
url: '/xdsl/:serviceName/orderMeeting',
interceptor,
},
},
);

xdsl.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 xdsl;
});