UserRepository

interface UserRepository

An interface representing a user repository, which provides methods to interact with user data and authentication.

Functions

Link copied to clipboard
abstract suspend fun changeUserPassword(currentPassword: String, newPassword: String): Either<AppError, Unit>

Changes the current user password currentPassword with a new one newPassword.

Link copied to clipboard
abstract suspend fun deleteUser(): Either<AppError, Unit>

Deletes the currently logged in user

Link copied to clipboard
abstract suspend fun getUser(): Either<AppError, User>

Gets the informations User of the currently logged in user

Link copied to clipboard
abstract suspend fun login(credentials: UserCredentials): Either<AppError, Unit>

Logs in the user with the given credentials UserCredentials.

Link copied to clipboard
abstract suspend fun logout(): Either<AppError, Unit>

Logs out the currently logged in user.

Link copied to clipboard
abstract suspend fun signUp(user: NewUser): Either<AppError, Unit>

Creates a new user with the given data NewUser and automatically logs in.

Properties

Link copied to clipboard
abstract val authState: AuthState

Returns the current AuthState: if the user is logged in or not (guest)