Python UserService Documentation
Methods
- get_user_by_id
- get_user_by_email
- get_user_role_by_auth_id
- get_user_id_by_auth_id
- get_auth_id_by_user_id
- get_users
- create_user
- update_user_by_id
- delete_user_by_id
- delete_user_by_email
get_user_by_id
get_user_by_id(user_id)
Get user associated with user_id
Arguments:
user_id
: user’s id- :type user_id: str
Returns:
a UserDTO with user’s information (:rtype: UserDTO)
Raises:
Exception
: if user retrieval fails
get_user_by_email
get_user_by_email(email)
Get user associated with email
Arguments:
email
: user’s email- :type email: str
Returns:
a UserDTO with user’s information (:rtype: UserDTO)
Raises:
Exception
: if user retrieval fails
get_user_role_by_auth_id
get_user_role_by_auth_id(auth_id)
Get role of user associated with auth_id
Arguments:
auth_id
: user’s auth_id- :type auth_id: str
Returns:
role of the user (:rtype: str)
Raises:
Exception
: if user role retrieval fails
get_user_id_by_auth_id
get_user_id_by_auth_id(auth_id)
Get id of user associated with auth_id
Arguments:
auth_id
: user’s auth_id- :type auth_id: str
Returns:
id of the user (:rtype: str)
Raises:
Exception
: if user_id retrieval fails
get_auth_id_by_user_id
get_auth_id_by_user_id(user_id)
Get auth_id of user associated with user_id
Arguments:
user_id
: user’s id- :type user_id: str
Returns:
auth_id of the user (:rtype: str)
Raises:
Exception
: if auth_id retrieval fails
get_users
get_users()
Get all users (possibly paginated in the future)
Returns:
list of UserDTOs (:rtype: [UserDTO])
Raises:
Exception
: if user retrieval fails
create_user
create_user(user, auth_id=None, signup_method="PASSWORD")
Create a user
Arguments:
user
: the user to be created- :type user: CreateUserDTO
auth_id
: user’s Firebase auth id, defaults to None- :type auth_id: str, optional
signup_method
: method of signup, either “PASSWORD” or “GOOGLE”, defaults to “PASSWORD”- :type signup_method: str, optional
Returns:
the created user (:rtype: UserDTO)
Raises:
Exception
: if user creation fails
update_user_by_id
update_user_by_id(user_id, user)
Update a user Note: the password cannot be updated using this method, use IAuthService.reset_password
instead
Arguments:
user_id
: user’s id- :type user_id: str
user
: the user to be updated- :type user: UpdateUserDTO
Returns:
the updated user (:rtype: UserDTO)
Raises:
Exception
: if user update fails
delete_user_by_id
delete_user_by_id(user_id)
Delete a user by user_id
Arguments:
user_id
: user_id of user to be deleted- :type user_id: str
Raises:
Exception
: if user deletion fails
delete_user_by_email
delete_user_by_email(email)
Delete a user by email
Arguments:
email
: email of user to be deleted- :type email: str
Raises:
Exception
: if user deletion fails