UserController

interface UserController

An interface defining access to a user and authentication mechanism.

Important: This interface is not stable for inheritance, as new methods may be added, but is stable for use.

Since

5.0.0

Functions

Link copied to clipboard
abstract suspend fun approveDevice(userCode: String)

Approve a DeviceAuthorizationRequest by its user code with the current user credentials.

Link copied to clipboard
abstract suspend fun authenticate(route: MimiAuthRoute): MimiUser

Attempts to authenticate a MimiUser through various different ways by specifying a MimiAuthRoute

Link copied to clipboard
abstract suspend fun logout()

Logs out the currently authenticated user and updates the UserController.mimiUser.

Link copied to clipboard
abstract suspend fun refreshUser(): MimiUser

Attempt to fetch and return the most updated state of the Mimi User from the backend, updating the UserController.mimiUser.

Link copied to clipboard
abstract suspend fun requestDeviceAuthorization(): DeviceAuthorizationRequest

Triggers a device authorization request. The result can be used to poll for a token with authenticate.

Link copied to clipboard
abstract suspend fun resetPassword(email: String)

Triggers the sending of a MimiUser password reset request to the backend.

Link copied to clipboard
abstract suspend fun revokeHearingAssessmentConsent()

Revoke consent for hearing assessments - this will disassociate the existing hearing tests from the user.

Link copied to clipboard
abstract suspend fun submitNickname(nickname: String): MimiUser

Submits the new nickname to the backend and returns the updated MimiUser

Link copied to clipboard
abstract suspend fun submitYearOfBirth(year: Int): MimiUser

Submits the new year of birth to the backend and returns the updated MimiUser

Link copied to clipboard
abstract fun userAccountPortalUrl(): Uri

Returns the url needed to access to the user's account portal

Properties

Link copied to clipboard
abstract val mimiUser: MimiObservable<AsyncState<MimiUser?>>

A MimiObservable exposing the current MimiUser.