Skip to content

Commit

Permalink
put.py & requester.py docstrings (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
malkin0xb8 authored Jul 22, 2024
1 parent e3dac0a commit 2639d31
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 32 deletions.
38 changes: 31 additions & 7 deletions odins_spear/methods/put.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def session(self):
#AUTHENTICATION

def user_authentication_service(self, user_id: str, new_password: str):
"""Set new SIP Authenticatino passowrd for a single user.
"""Set new SIP Authentication password for a single user.
Args:
user_id (str): Target user ID to reset the web authentication password.
Expand Down Expand Up @@ -382,7 +382,7 @@ def user_call_center_supervised_agents(self, call_center_user_id: str,


def user_call_center(self, user_id: str, updates: dict):
"""Update an agents status in a Call Center (CC).
"""Update an agent's status in a Call Center (CC).
Args:
user_id (str): User ID of the target user.
Expand Down Expand Up @@ -725,7 +725,7 @@ def system_device_tag(self, device_name: str, tag_name: str, tag_value: str):

def group_device_type_file(self, service_provider_id: str, group_id: str,
device_type: str, updates: dict):
"""Set config file for all devices of a spceific type at the group level.
"""Set config file for all devices of a specific type at the group level.
Args:
service_provider_id (str): Service Provider or Enterprise ID where Group is located.
Expand Down Expand Up @@ -832,7 +832,7 @@ def group_dns_activate(self, service_provider_id: str, group_id: str, activated:
#DO NOT DISTURB

def user_do_not_disturb(self, user_id: str, dnd_active: bool = False, ring_splash_active: bool = False ):
"""Updates a users DND and Ring Splash status.
"""Updates a user's DND and Ring Splash status.
Args:
user_id (str): Target user id of user you would like to update the state of.
Expand Down Expand Up @@ -1008,7 +1008,7 @@ def group_hunt_group_weighted_call_distribution(self, service_provider_id: str,
#SERVICES

def user_services(self, user_id: str, services: list =None, service_packs: list =None, assigned: bool =True):
"""Update the services assigend to a user. NOT service/ feature packs.
"""Update the services assigned to a user. NOT service/feature packs.
Args:
user_id (str): User ID of the target user.
Expand Down Expand Up @@ -1133,7 +1133,18 @@ def service_providers_trunk_group_call_capacity(self, service_provider_id: str,
#USERS

def users_bulk(self, users: list, updates: dict):
"""
Updates specified list of User's options, such as extension, name and etc.
Note: Available options to change can be seen through: get.user_by_id()
Args:
users (list): List of specified User IDs to update
updates (dict): The updates to be applied to the list of Users e.g {"extension":"9999"}
Returns:
Dict: Returns the changes made including the list of User IDs and updates.
"""
endpoint = "/users/bulk"

target_users = [{"userId": user} for user in users]
Expand All @@ -1146,8 +1157,21 @@ def users_bulk(self, users: list, updates: dict):
return self.requester.put(endpoint, data=data)


def user(self, service_provider_id: str, group_id, user_id: str, updates: dict):
def user(self, service_provider_id: str, group_id: str, user_id: str, updates: dict):
"""
Updates specified User's options, such as extension, name and etc.
Note: Available options to change can be seen through: get.user_by_id()
Args:
service_provider_id (str): Target Service Provider where group is located
group_id (str): Target Group ID where user is located
user_id (str): Target User ID
updates (dict): The updates to be applied to the list of Users e.g {"extension":"9999"}
Returns:
Dict: Returns the changes made including User ID and updates.
"""
endpoint = "/users"

updates["serviceProviderId"] = service_provider_id
Expand All @@ -1158,7 +1182,7 @@ def user(self, service_provider_id: str, group_id, user_id: str, updates: dict):


def user_portal_passcode(self, user_id: str, new_passcode: str):
"""_summary_
"""Updates the specified User's portal passcode.
Args:
user_id (str): User ID of the target user you would like to change the portal passcode for.
Expand Down
62 changes: 37 additions & 25 deletions odins_spear/scripter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ def __init__(self, api) -> None:

def aa_cc_hg_audit(self, service_provider_id: str, group_id: str):
"""
This script returns the services assigned to Auto Attendants,
Call Centres, and Hunt Groups. Only services are applied to these
entities and there are scenarios one would need to focus services
assigned to these entities.
This script returns the services assigned to Auto Attendants,
Call Centres, and Hunt Groups. Only services are applied to these
entities and there are scenarios one would need to focus services
assigned to these entities.
Args:
service_provider_id: Service Provider ID or Enterprise ID containing the Group ID.
group_id: Group ID to generate the report for.
:param service_provider_id: Service Provider ID or Enterprise ID containing the Group ID.
:param group_id: Group ID to generate the report for.
:return JSON: A JSON formatted report of service packs assigned to AA, CC, and HG.
Returns:
JSON: A JSON formatted report of service packs assigned to AA, CC, and HG.
"""
return scripts.aa_cc_hg_audit.main(self.api, service_provider_id, group_id)

Expand All @@ -38,7 +39,7 @@ def bulk_enable_voicemail(self, users):


def bulk_password_reset(self, service_provider_id: str, group_id: str, users: list, password_type: str):
""" Resets a list of users SIP passwords or Voicemail passcodes. Specifify in password_type with the options of
""" Resets a list of users SIP passwords or Voicemail passcodes. Specify in password_type with the options of
'SIP' or 'Voicemail' and the script will perform the necessary actions.
Args:
Expand All @@ -59,12 +60,17 @@ def bulk_password_reset(self, service_provider_id: str, group_id: str, users: li
def find_alias(self, service_provider_id: str, group_id: str, alias: str):
""" Locates alias if assigned to broadworks entity.
:param service_provider_id (str): Service Prodiver where group is hosted.
:param group_id (str): Group where alias is located.
:param alias (int): Alias number to identify e.g. 0
Args:
service_provider_id (str): Service Prodiver where group is hosted.
group_id (str): Group where alias is located.
alias (int): Alias number to identify e.g. 0
:return str: Returns type and name/ userId of entity where alias located.
:raise AOALiasNotFound: If alias not found AOAliasNotFound error raised
Raises:
AOALiasNotFound: If alias not found AOAliasNotFound error raised
Returns:
str: Returns type and name/ userId of entity where alias located.
"""
return scripts.find_alias.main(self.api, service_provider_id, group_id,
alias)
Expand All @@ -75,10 +81,12 @@ def group_audit(self, service_provider_id: str, group_id: str):
Produces a report of key information within the group.
Reports on DN usage, Service and Service pack usage, Trunking call capacity and group info.
:param service_provider_id (str): Service Provider ID or Enterprise ID containing the Group ID.
:param group_id (str): Group ID to generate the report for.
Args:
service_provider_id (str): Service Provider ID or Enterprise ID containing the Group ID.
group_id (str): Group ID to generate the report for.
:return str: A JSON formatted report of the group.
Returns:
str: A JSON formatted report of the group.
"""
return scripts.group_audit.main(self.api, service_provider_id, group_id)

Expand All @@ -89,10 +97,12 @@ def service_pack_audit(self, servive_provider_id, group_id):
the group. This only shows the service packs assigned and total count of unlike group audit
which details the users this is assigned to.
:param service_provider_id (str): Service Provider ID or Enterprise ID containing the Group ID.
:param group_id (str): Group ID to generate the report for.
Args:
service_provider_id (str): Service Provider ID or Enterprise ID containing the Group ID.
group_id (str): Group ID to generate the report for.
:return str: A JSON formatted report of service packs assigned in the group.
Returns:
str: A JSON formatted report of service packs assigned in the group.
"""
return scripts.service_pack_audit.main(self.api, servive_provider_id, group_id)

Expand All @@ -103,14 +113,16 @@ def user_activity(self, user):

def user_association(self, service_provider_id: str, group_id: str, user_id: str):
"""
identify a user's associations with Call Centers (CC), Hunt Groups (HG),
Identify a user's associations with Call Centers (CC), Hunt Groups (HG),
and Pick Up Groups.
:pararm service_provider_id (str): Service Provider where the group is hosted.
:pararm group_id (str): Group where the User is located.
:pararm user_id (str): Target user ID.
Args:
service_provider_id (str): Service Provider where the group is hosted.
group_id (str): Group where the User is located.
user_id (str): Target user ID.
:returns (str): Formatted output of the user showing all CC, HG, and Pick Up user is assigned to.
Returns:
str: Formatted output of the user showing all CC, HG, and Pick Up user is assigned to.
"""
return scripts.user_association.main(self.api, service_provider_id, group_id, user_id)

Expand Down

0 comments on commit 2639d31

Please sign in to comment.