From b68e8df648ae6e6fdb2f99f9db188ea08e4b513f Mon Sep 17 00:00:00 2001 From: Olivia Curtis <133100222+LivCurtis@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:39:13 +0100 Subject: [PATCH] 99 add all hunt group methods (#106) --- odins_spear/methods/delete.py | 22 ++++++++++++++++++++++ odins_spear/methods/get.py | 21 +++++++++++++++++++++ odins_spear/methods/post.py | 24 ++++++++++++++++++++++++ odins_spear/requester.py | 4 ++-- 4 files changed, 69 insertions(+), 2 deletions(-) diff --git a/odins_spear/methods/delete.py b/odins_spear/methods/delete.py index 0f9d849..c3ffc3a 100644 --- a/odins_spear/methods/delete.py +++ b/odins_spear/methods/delete.py @@ -145,6 +145,28 @@ def service_provider_dns(self, service_provider_id: str, start_of_range_number: #HOTELING GUEST #HOTELING HOST #HUNT GROUPS + + def group_hunt_group(self, service_user_id: str): + + """Deletes the specified hunt group. + + Args: + service_user_id (str): The service user ID of the hunt group to be deleted. + + Returns: + Dict: Profile of the deleted hunt group. + + """ + + endpoint = "/groups/hunt-groups" + + params = { + "serviceUserId": service_user_id + } + + return self.requester.delete(endpoint, params=params) + + #IN CALL SERVICE ACTIVATION #INSTANT GROUP CALL #INTEGRATED IMP diff --git a/odins_spear/methods/get.py b/odins_spear/methods/get.py index d5ac142..3f9dc29 100644 --- a/odins_spear/methods/get.py +++ b/odins_spear/methods/get.py @@ -910,6 +910,27 @@ def group_hunt_group_user(self, service_provider_id, group_id, user_id): } return self.requester.get(endpoint, params=params) + + def group_hunt_groups_available_users(self, service_provider_id: str, group_id: str): + + """Returns a list of all users within the service provider that are available to be assigned to a hunt group in the specified group. + + Args: + service_provider_id (str): Target Service Provider ID + group_id (str): Target Group ID + + Returns: + List: available users (dict) + """ + + endpoint = "/groups/hunt-groups/users" + + params = { + "serviceProviderId": service_provider_id, + "groupId": group_id + } + + return self.requester.get(endpoint, params=params) #IN CALL SERVICE ACTIVATION diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index 0e9a0c3..491acac 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -315,6 +315,30 @@ def group_hunt_group(self, service_provider_id: str, group_id: str, service_user payload["serviceInstanceProfile"]["extension"] = extension return self.requester.post(endpoint, data=payload) + + + def group_hunt_groups_remove_user(self, service_provider_id: str, group_id: str, user_id: str): + + """Removes the specified user from all hunt groups in which it currently exists. + + Args: + service_provider_id (str): The service provider ID in which the target user exists. + group_id (str): The group ID where the user exists. + user_id (str): The User ID of the user that is to be removed from the hunt group(s). + + Returns: + List: Service user ID's (str) of the hunt groups from which the specified user has been removed. + """ + + endpoint = "/groups/hunt-groups/removeUser" + + data = { + "serviceProviderId": service_provider_id, + "groupId": group_id, + "userId": user_id + } + + return self.requester.post(endpoint, data=data) #IN CALL SERVICE ACTIVATION #INSTANT GROUP CALL diff --git a/odins_spear/requester.py b/odins_spear/requester.py index eadee86..e68abd6 100644 --- a/odins_spear/requester.py +++ b/odins_spear/requester.py @@ -37,8 +37,8 @@ def put(self, endpoint, data=None): return self._request(requests.put, endpoint, data) - def delete(self, endpoint, data=None): - return self._request(requests.delete, endpoint, data) + def delete(self, endpoint, data=None, params=None): + return self._request(requests.delete, endpoint, data, params) def _request(self, method, endpoint, data=None, params=None):