Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def activate_factor(
self, userId, factorId, activate_factor_request
):
"""
The `sms` and `token:software:totp` factor types requir
e activation to complete the enrollment process.
Args:
user_id {str}
factor_id {str}
{activate_factor_request}
Returns:
UserFactor
"""
http_method = "post".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/users/{userId}/factors/{factorId}/lifecycle
/activate
""")
body = activate_factor_request.as_dict()
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
async def end_session(
self, sessionId
):
"""
Method for
/api/v1/sessions/{sessionId}
Args:
session_id {str}
"""
http_method = "delete".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/sessions/{sessionId}
""")
body = {}
headers = {}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
return (None, error)
response, error = await self._request_executor\
.execute(request)
async def list_user_types(
self
):
"""
Fetches all User Types in your org
Args:
Returns:
list: Collection of UserType instances.
"""
http_method = "get".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/meta/types/user
""")
body = {}
headers = {}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
return (None, None, error)
response, error = await self._request_executor\
.execute(request, UserType)
async def get_refresh_token_for_authorization_server_and_client(
self, authServerId, clientId, tokenId, query_params={}
):
"""
Args:
auth_server_id {str}
client_id {str}
token_id {str}
query_params {dict}: Map of query parameters for request
[query_params.expand] {str}
Returns:
OAuth2RefreshToken
"""
http_method = "get".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/authorizationServers/{authServerId}/clients
/{clientId}/tokens/{tokenId}
""")
if query_params:
encoded_query_params = urlencode(query_params)
api_url += f"/?{encoded_query_params}"
body = {}
headers = {}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
async def partial_update_sms_template(
self, templateId, sms_template
):
"""
Updates only some of the SMS template properties:
Args:
template_id {str}
{sms_template}
Returns:
SmsTemplate
"""
http_method = "post".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/templates/sms/{templateId}
""")
body = sms_template.as_dict()
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
return (None, None, error)
async def list_features(
self
):
"""
Args:
Returns:
list: Collection of Feature instances.
"""
http_method = "get".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/features
""")
body = {}
headers = {}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
return (None, None, error)
response, error = await self._request_executor\
.execute(request, Feature)
async def delete_event_hook(
self, eventHookId
):
"""
Args:
event_hook_id {str}
"""
http_method = "delete".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/eventHooks/{eventHookId}
""")
body = {}
headers = {}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
return (None, error)
response, error = await self._request_executor\
.execute(request)
"""
Gets a refresh token issued for the specified User and
Client.
Args:
user_id {str}
client_id {str}
token_id {str}
query_params {dict}: Map of query parameters for request
[query_params.expand] {str}
[query_params.limit] {str}
[query_params.after] {str}
Returns:
OAuth2RefreshToken
"""
http_method = "get".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/users/{userId}/clients/{clientId}/tokens
/{tokenId}
""")
if query_params:
encoded_query_params = urlencode(query_params)
api_url += f"/?{encoded_query_params}"
body = {}
headers = {}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
ganization’s system log. This API provides more functio
nality than the Events API
Args:
query_params {dict}: Map of query parameters for request
[query_params.until] {str}
[query_params.since] {str}
[query_params.filter] {str}
[query_params.q] {str}
[query_params.limit] {str}
[query_params.sortOrder] {str}
[query_params.after] {str}
Returns:
list: Collection of LogEvent instances.
"""
http_method = "get".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/logs
""")
if query_params:
encoded_query_params = urlencode(query_params)
api_url += f"/?{encoded_query_params}"
body = {}
headers = {}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
return (None, None, error)
async def add_linked_object_definition(
self, linked_object
):
"""
Args:
{linked_object}
Returns:
LinkedObject
"""
http_method = "post".upper()
api_url = format_url(f"""
{self._base_url}
/api/v1/meta/schemas/user/linkedObjects
""")
body = linked_object.as_dict()
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
request, error = await self._request_executor.create_request(
http_method, api_url, body, headers
)
if error:
return (None, None, error)