From 32d263de34918541f5115bc0f4e2cc8b3ad367ff Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:44:23 +0100 Subject: [PATCH 1/4] Update post.py Added post.group_admin method --- odins_spear/methods/post.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index 948bf57..df5ad9a 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -31,6 +31,31 @@ def session_switch(self, username: str): #ACCOUNT AUTHORIZATION CODES #ADMINISTRATORS + + def group_admin(self, service_provider_id: str, group_id: str, user_id: str, password: str, payload: dict = {}): + """Builds a group-level administrator. + + Args: + service_provider_id (str): Service provider ID where the admin should be built. + group_id (str): Group ID where the admin should be built + user_id (str): User ID of the admin. + password (str): Password for the administrator profile. Note get.password_generate() can be used to get this. + payload (dict, optional): Admin configuration data. + + Returns: + Dict: Returns the device profile. + """ + + endpoint = "/groups/admins" + + payload["serviceProviderId"] = service_provider_id + payload["groupId"] = group_id + payload["userId"] = user_id + payload["password"] = password + + return self.requester.post(endpoint, data=payload) + + #ADVICE OF CHARGE #ALTERNATE NUMBERS #ANSWER CONFIRMATION From 29147ff124ee2370678d0fa0092042673b641875 Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Wed, 2 Oct 2024 10:48:55 +0100 Subject: [PATCH 2/4] Update post.py Added post.group_emergency_zones method. --- odins_spear/methods/post.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index df5ad9a..0395be4 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -280,6 +280,30 @@ def service_provider_dns(self, service_provider_id: str, start_of_range_number: #DOMAINS #EMERGENCY NOTIFICATIONS #EMERGENCY ZONES + + def group_emergency_zones(self, service_provider_id: str, group_id: str, ip_addresses: list): + """Updates the IP address(es) for the Emergency Zone configured in the group. + + Args: + service_provider_id (str): Service provider ID where the Emergency Zone to be updated exists. + group_id (str): Group ID where the Emergency Zone to be updated exists. + ip_addresses (list): A list of IP address ranges (dicts) to be added to the Emergency Zone. If the IP address to be applied is not a range, the min and max values should be the same. + + Returns: + dict: Emergency Zone profile with updated IP addresses. + """ + + endpoint = "/groups/emergency-zones" + + data = { + "serviceProviderId": service_provider_id, + "groupId": group_id, + "ipAddresses": ip_addresses + } + + return self.requester.post(endpoint, data=data) + + #ENTERPRISE TRUNKS #EXECUTIVE #EXECUTIVE ASSISTANT From 6e54e5c31ff43fe418e0a9d65f38a3647c7fc53c Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:22:24 +0100 Subject: [PATCH 3/4] Update put.py Added put.group_emergency_zones method. --- odins_spear/methods/put.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 1272d69..9bb421c 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -859,6 +859,41 @@ def user_do_not_disturb(self, user_id: str, dnd_active: bool = False, ring_splas #DOMAINS #EMERGENCY NOTIFICATIONS #EMERGENCY ZONES + + def group_emergency_zones(self, service_provider_id: str, group_id: str, is_active: bool=True, zone_rules: str=None, emergency_notification_email: str=None, ip_addresses: list=None): + """Updates the Emergency Zone configuration in the group. + + Args: + service_provider_id (str): Service provider ID where the Emergency Zone to be updated exists. + group_id (str): Group ID where the Emergency Zone to be updated exists. + is_active (bool, optional): Whether the Emergency Zone service is active or not. Defaults to True + zone_rules (str, optional): The rules of the Emergency Zone. This will either be "Prohibit all registrations and call originations" or "Prohibit emergency call originations". + ip_addresses (list, optional): A list of IP address ranges (dicts) to be added to the Emergency Zone. If the IP address to be applied is not a range, the min and max values should be the same. + + Returns: + dict: Emergency Zone profile with updated IP addresses. + """ + + endpoint = "/groups/emergency-zones" + + data = { + "groupId": group_id, + "serviceProviderId": service_provider_id + } + + if is_active: + data["isActive"] = is_active + if zone_rules: + data["emergencyZonesProhibition"] = zone_rules + if emergency_notification_email: + data["sendEmergencyCallNotifyEmail"] = True + data["emergencyCallNotifyEmailAddress"] = emergency_notification_email + if ip_addresses: + data["ipAddresses"] = ip_addresses + + return self.requester.put(endpoint, data) + + #ENTERPRISE TRUNKS #EXECUTIVE #EXECUTIVE ASSISTANT From 2d8b32c9a36f05e62a6e855b7fedf875ae0e17d8 Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:38:44 +0100 Subject: [PATCH 4/4] Corrected typo --- odins_spear/methods/post.py | 2 +- odins_spear/methods/put.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index 0395be4..268609e 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -290,7 +290,7 @@ def group_emergency_zones(self, service_provider_id: str, group_id: str, ip_addr ip_addresses (list): A list of IP address ranges (dicts) to be added to the Emergency Zone. If the IP address to be applied is not a range, the min and max values should be the same. Returns: - dict: Emergency Zone profile with updated IP addresses. + Dict: Emergency Zone profile with updated IP addresses. """ endpoint = "/groups/emergency-zones" diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 9bb421c..5bbd722 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -868,10 +868,11 @@ def group_emergency_zones(self, service_provider_id: str, group_id: str, is_acti group_id (str): Group ID where the Emergency Zone to be updated exists. is_active (bool, optional): Whether the Emergency Zone service is active or not. Defaults to True zone_rules (str, optional): The rules of the Emergency Zone. This will either be "Prohibit all registrations and call originations" or "Prohibit emergency call originations". + emergency_notification_email (str, optional): The email address where emergency call notifications should be sent. ip_addresses (list, optional): A list of IP address ranges (dicts) to be added to the Emergency Zone. If the IP address to be applied is not a range, the min and max values should be the same. Returns: - dict: Emergency Zone profile with updated IP addresses. + Dict: Updated Emergency Zone configuration. """ endpoint = "/groups/emergency-zones"