Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

114 entire user functionality #136

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
20 changes: 20 additions & 0 deletions odins_spear/methods/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,26 @@ def group_hunt_group(self, service_user_id: str):
#TRUNK GROUPS
#TWO STAGE DIALING
#USERS

def user(self, user_id: str):

malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
"""Deletes the specified User

Args:
user_id (str): The target user ID to be deleted.

Returns:
Nothing
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved

"""

endpoint = "/users"

params = {
"userId": user_id
}

return self.requester.delete(endpoint, params=params)
#USER CUSTOM RINGBACK
#VIDEO ADD ON
#VIRTUAL ON-NET ENTERPRISE EXTENSIONS
Expand Down
82 changes: 82 additions & 0 deletions odins_spear/methods/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,23 @@ def sip_passwords_generate(self, limit: int =10) -> dict:

return self.requester.get(endpoint, params = params)

def user_portal_passcode(self, user_id: str):
"""Pulls the target user's portal passcode

Args:
user_id (str): The target user's UserID

Returns:
dict: Portal Passcode
"""

endpoint = "/users/portal-passcode"

params = {
"userId": user_id
}

return self.requester.get(endpoint, params = params)
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
#PASSWORD RULES
#PERSONAL PHONE LIST
#PHONE DIRECTORY
Expand Down Expand Up @@ -1515,6 +1532,71 @@ def user_by_id(self, user_id: str):
}

return self.requester.get(endpoint, params=params)

def group_user_audit(self, service_provider_id: str, group_id: str, user_id: str):
"""Returns extensive details of a single user including device type, calling plans, licenses and etc

Args:
service_provider_id (str): Target Service Provider the Group resides in.
group_id (str): Target GroupID the User Resides in.
user_id (str): Target user ID of the user you would like to review.

Returns:
Dict: Python dictionary of the users details
"""

endpoint = "/users/audit"

params = {
"serviceProviderId": service_provider_id,
"groupId": group_id,
"userId": user_id
}

return self.requester.get(endpoint, params=params)

def user_audit(self, user_id: str):
"""Returns extensive details of a single user including device type, calling plans, licenses and etc

Args:
user_id (str): Target user ID of the user you would like to review.

Returns:
Dict: Python dictionary of the users details
"""

endpoint = "/users/audit"

params = {
"userId": user_id
}

return self.requester.get(endpoint, params=params)

def user_login_info(
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
self,
user_id: str,
new_user_id: str
):
"""
Gets The Specified Users Login Information

Args:
user_id (str): Users Original Identifier
new_id (str): New User Identifier

Returns:
Json: A Stub Of The Users Login Information
"""

endpoint = "/users/login?userId=" + user_id

data = {
"userId": user_id,
"newUserId": new_user_id
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
}

return self.requester.put(endpoint, data=data)

# USER CUSTOM RINGBACK
# VIDEO ADD ON
Expand Down
85 changes: 84 additions & 1 deletion odins_spear/methods/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,48 @@ def group_device(self, service_provider_id: str, group_id: str, device_name: str
payload["deviceType"] = device_type

return self.requester.post(endpoint, data=payload)

def group_device_rebuild(self, service_provider_id: str, group_id: str, device_name: str, ):
"""Rebuilds the configuration files for the specified device.

Args:
service_provider_id (str): Service provider ID where the device should be rebuilt.
group_id (str): Group ID where the device should be rebuilt
device_name (str); Name of the target device to be rebuilt

Returns:
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
Nothing
"""
endpoint = "/groups/devices/rebuild"

data = {
"deviceName": device_name,
"serviceProviderId": service_provider_id,
"groupId": group_id
}

return self.requester.post(endpoint, data=data)

def group_device_reset(self, service_provider_id: str, group_id: str, device_name: str, ):
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
"""Sends a reboot request to the specified device.

Args:
service_provider_id (str): Service provider ID where the device should be reset.
group_id (str): Group ID where the device should be reset
device_name (str); Name of the target device to be reset

Returns:
Nothing
"""
endpoint = "/groups/devices/reset"

data = {
"deviceName": device_name,
"serviceProviderId": service_provider_id,
"groupId": group_id
}

return self.requester.post(endpoint, data=data)

#DIAL PLAN POLICY
#DIRECTED CALL PICKUP WITH BARGE IN
Expand Down Expand Up @@ -495,6 +537,47 @@ def user(self, service_provider_id: str, group_id: str, user_id: str, first_name
payload["password"] = web_auth_password

return self.requester.post(endpoint, data=payload)


def user_reset(
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
self,
user_id: str,
remove_from_group_services: bool,
remove_call_records: bool,
remove_alternate_user_ids: bool,
remove_webex_person: bool,
cycle_service_packs: bool,
reset_password_passcode: bool,
):
"""
Updates A Specified Users User Identifier

Args:
user_id (str): Users Original Identifier
remove_from_group_services (bool): Remove From Group Services
remove_call_records (bool): Remove Call Record Instances
remove_alternate_user_ids (bool): Remove Alternate User Identifiers
remove_webex_person (bool): Remove Webex Entry
cycle_service_packs (bool): Shift Service Packs
reset_password_passcode (bool): Reset Password Forcing A New Login And Password

Returns:
None: No Specified Return Type
"""

endpoint = "/users/reset"

data = {
"userId": user_id,
"removeFromGroupServices": remove_from_group_services,
"removeCallRecords": remove_call_records,
"removeAlternateUserIds": remove_alternate_user_ids,
"removeWebexPerson": remove_webex_person,
"cycleServicePacks": cycle_service_packs,
"resetPasswordPasscode": reset_password_passcode
}

return self.requester.post(endpoint, data=data)

#USER CUSTOM RINGBACK
#VIDEO ADD ON
Expand Down Expand Up @@ -528,4 +611,4 @@ def user(self, service_provider_id: str, group_id: str, user_id: str, first_name
#USER UTILITIES
#ODIN TASKS COPY
#ODIN CONNECTORS
#LOCALES
#LOCALES
73 changes: 73 additions & 0 deletions odins_spear/methods/put.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,79 @@ def user_portal_passcode(self, user_id: str, new_passcode: str):
}

return self.requester.put(endpoint, data=data)

def user_id(self, user_id: str, new_id: str):
"""
Updates A Specified Users User Identifier

Args:
user_id (str): Users Original Identifier
new_id (str): New User Identifier

Returns:
None: No Specified Return Type
"""
endpoint = "/users/user-id"

data = {
"userId": user_id,
"newUserId": new_id
}

return self.requester.put(endpoint, data=data)

def user_group_id_update(
self,
user_id: str,
new_group_id: str,
evaluate_only: bool = False
):
"""
Update The Group ID Associated With A User

Args:
user_id (str): Users Identifier
new_group_id (str): New Group Identifier
evaluate_only (bool): Evaluates Whether The Change Is Possible

Returns:
None: No Specified Return Type
"""

endpoint = "/users/group-id"

data = {
"userId": user_id,
"newGroupId": new_group_id,
"evaluateOnly": evaluate_only
}

return self.requester.put(endpoint, data=data)

def user_login_info(
malkin0xb8 marked this conversation as resolved.
Show resolved Hide resolved
self,
user_id: str,
new_user_id: str
):
"""
Gets The Specified Users Login Information

Args:
user_id (str): Users Original Identifier
new_id (str): New User Identifier

Returns:
Json: A Stub Of The Users Login Information
"""

endpoint = "/users/login?userId=" + user_id

data = {
"userId": user_id,
"newUserId": new_user_id
}

return self.requester.put(endpoint, data=data)


#USER CUSTOM RINGBACK
Expand Down