from .base import Base
[docs]class Users(Base):
endpoint = '/users'
[docs] def login_user(self, options):
return self.client.make_request('post', self.endpoint + '/login', options)
[docs] def logout_user(self):
return self.client.post(self.endpoint + '/logout')
[docs] def create_user(self, options=None, params=None):
return self.client.post(self.endpoint, options=options, params=params)
[docs] def get_users(self, params=None):
return self.client.get(self.endpoint, params=params)
[docs] def get_users_by_ids(self, options=None):
return self.client.post(
self.endpoint + '/ids',
options
)
[docs] def get_users_by_usernames(self, options=None):
return self.client.post(
self.endpoint + '/usernames',
options
)
[docs] def search_users(self, options=None):
return self.client.post(
self.endpoint + '/search',
options
)
[docs] def autocomplete_users(self, params=None):
return self.client.get(
self.endpoint + '/autocomplete',
params=params
)
[docs] def get_user(self, user_id):
return self.client.get(
self.endpoint + '/' + user_id
)
[docs] def update_user(self, user_id, options=None):
return self.client.put(
self.endpoint + '/' + user_id,
options
)
[docs] def deactivate_user(self, user_id):
return self.client.delete(
self.endpoint + '/' + user_id
)
[docs] def patch_user(self, user_id, options=None):
return self.client.put(
self.endpoint + '/' + user_id + '/patch',
options
)
[docs] def update_user_role(self, user_id, options=None):
return self.client.put(
self.endpoint + '/' + user_id + '/roles',
options
)
[docs] def update_user_active_status(self, user_id, options=None):
return self.client.put(
self.endpoint + '/' + user_id + '/active',
options
)
[docs] def get_user_profile_image(self, user_id):
return self.client.get(
self.endpoint + '/' + user_id + '/image'
)
[docs] def set_user_profile_image(self, user_id, files):
return self.client.post(
self.endpoint + '/' + user_id + '/image',
files=files
)
[docs] def get_user_by_username(self, username):
return self.client.get(
self.endpoint + '/username/' + username
)
[docs] def reset_password(self, options=None):
return self.client.post(
self.endpoint + '/password/reset',
options
)
[docs] def update_user_mfa(self, user_id, options=None):
return self.client.put(
self.endpoint + '/' + user_id + '/mfa',
options
)
[docs] def generate_mfa(self, user_id):
return self.client.post(
self.endpoint + '/' + user_id + '/mfa/generate'
)
[docs] def check_mfa(self, options=None):
return self.client.post(
self.endpoint + '/mfa',
options
)
[docs] def update_user_password(self, user_id, options=None):
return self.client.put(
self.endpoint + '/' + user_id + '/password',
options
)
[docs] def send_password_reset_mail(self, options=None):
return self.client.post(
self.endpoint + '/password/reset/send',
options
)
[docs] def get_user_by_email(self, email):
return self.client.get(
self.endpoint + '/email/' + email
)
[docs] def get_user_sessions(self, user_id):
return self.client.get(
self.endpoint + '/' + user_id + '/sessions'
)
[docs] def revoke_user_session(self, user_id, options=None):
return self.client.post(
self.endpoint + '/' + user_id + '/sessions/revoke',
options
)
[docs] def revoke_all_user_sessions(self, user_id):
return self.client.post(
self.endpoint + '/' + user_id + '/sessions/revoke/all',
)
[docs] def attach_mobile_device(self, options=None):
return self.client.put(
self.endpoint + '/sessions/device',
options
)
[docs] def get_user_audits(self, user_id):
return self.client.get(
self.endpoint + '/' + user_id + '/audits'
)
[docs] def verify_user_email(self, options=None):
return self.client.post(
self.endpoint + '/email/verify',
options
)
[docs] def send_verification_mail(self, options=None):
return self.client.post(
self.endpoint + '/email/verify/send',
options
)
[docs] def switch_login_method(self, options=None):
return self.client.post(
self.endpoint + '/login/switch',
options
)
[docs] def disable_personal_access_token(self, options=None):
return self.client.post(
self.endpoint + '/tokens/disable',
options
)
[docs] def enable_personal_access_token(self, options=None):
return self.client.post(
self.endpoint + '/tokens/enable',
options
)
[docs] def get_user_access_token(self, token_id):
return self.client.get(
self.endpoint + '/tokens/' + token_id
)
[docs] def search_tokens(self, options=None):
return self.client.post(
self.endpoint + '/tokens/search',
options=options
)
[docs] def update_user_authentication_method(self, user_id, options=None):
return self.client.put(
self.endpoint + '/' + user_id + '/auth',
options=options
)
[docs] def create_user_access_token(self, user_id, options=None):
return self.client.post(
self.endpoint + '/' + user_id + '/tokens',
options=options
)
[docs] def get_stats(self):
return self.client.get(
self.endpoint + '/stats'
)