Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sceyt/sceyt-chat-android-uikit/llms.txt

Use this file to discover all available pages before exploring further.

UserInteractor is the interface responsible for all user-profile, presence, and block-list operations in the Sceyt Chat Android UIKit. It is accessible via SceytChatUIKit.chatUIFacade.userInteractor. All methods are suspend functions unless otherwise noted. Methods that communicate with the server return SceytResponse<T> — a sealed class with Success and Error variants. Methods that only touch the local database return the result type directly. Package: com.sceyt.chatuikit.persistence.interactor
val interactor: UserInteractor = SceytChatUIKit.chatUIFacade.userInteractor

Searching and Loading Users

loadUsers
suspend fun → SceytResponse<List<SceytUser>>
Executes the supplied UserListQuery against the server and returns the matching page of users.
val query = UserListQuery.Builder()
    .limit(30)
    .filter(UserListQuery.UserListFilterType.Key)
    .build()

when (val result = interactor.loadUsers(query)) {
    is SceytResponse.Success -> showUsers(result.data)
    is SceytResponse.Error   -> showError(result.exception)
}
loadMoreUsers
suspend fun → SceytResponse<List<SceytUser>>
Loads the next page of results from the most recently executed loadUsers query. Must be called after loadUsers has returned a successful response.
val nextPage = interactor.loadMoreUsers()

Fetching Users

getUserById
suspend fun → SceytResponse<SceytUser>
Fetches a single user’s public profile from the server by their unique user ID.
when (val result = interactor.getUserById("user-abc-123")) {
    is SceytResponse.Success -> displayProfile(result.data)
    is SceytResponse.Error   -> handleError(result.exception)
}
getUsersByIds
suspend fun → SceytResponse<List<SceytUser>>
Fetches the public profiles of multiple users in a single server request.
val result = interactor.getUsersByIds(listOf("user-1", "user-2", "user-3"))
getUserFromDbById
suspend fun → SceytUser?
Returns a user from the local database by their ID, or null if they have not been cached.
val cached: SceytUser? = interactor.getUserFromDbById("user-abc-123")
getUsersFromDbByIds
suspend fun → List<SceytUser>
Returns multiple users from the local database by their IDs. Missing users are silently omitted from the result list.
searchLocaleUserByMetadata
suspend fun → List<SceytUser>
Performs a local (offline) search of cached users by matching a metadata value against the specified metadata keys. Useful for looking up users by custom attributes stored in user metadata.
val matches = interactor.searchLocaleUserByMetadata(
    metadataKeys  = listOf("department", "team"),
    metadataValue = "engineering"
)

Current User

getCurrentUser
suspend fun → SceytUser?
Returns the currently authenticated user. When refreshFromServer is true, fetches the latest profile from the server before returning; otherwise, returns the cached value.
val me: SceytUser? = interactor.getCurrentUser(refreshFromServer = true)
getCurrentUserId
fun → String?
Synchronously returns the current user’s ID from the local authentication state, or null if no user is authenticated. This is a non-suspending function safe to call on the main thread.
val userId: String? = interactor.getCurrentUserId()
getCurrentUserAsFlow
fun → Flow<SceytUser>?
Returns a Flow that emits the current user’s profile from the local database and re-emits whenever the profile is updated. Returns null if there is no authenticated user.
interactor.getCurrentUserAsFlow()
    ?.onEach { user -> updateToolbarAvatar(user) }
    ?.launchIn(lifecycleScope)

Updating Profile

uploadAvatar
suspend fun → SceytResponse<String>
Uploads a local image file to the Sceyt CDN and returns the resulting avatar URL. Use the returned URL with updateProfile to apply the new avatar.
val result = interactor.uploadAvatar(localFilePath)
if (result is SceytResponse.Success) {
    interactor.updateProfile(
        username  = currentUser.username,
        firstName = currentUser.firstName,
        lastName  = currentUser.lastName,
        avatarUrl = result.data,
        metadataMap = null
    )
}
updateProfile
suspend fun → SceytResponse<SceytUser>
Updates the current user’s profile fields. Pass null for fields you do not want to change.
interactor.updateProfile(
    username    = "john_doe",
    firstName   = "John",
    lastName    = "Doe",
    avatarUrl   = "https://cdn.example.com/avatars/john.jpg",
    metadataMap = mapOf("department" to "engineering")
)

Presence and Status

setPresenceState
suspend fun → SceytResponse<Boolean>
Sets the current user’s presence state on the server (e.g. Online, Away, Offline).
interactor.setPresenceState(PresenceState.Away)
updateStatus
suspend fun → SceytResponse<Boolean>
Updates the current user’s text status message shown alongside their presence indicator.
interactor.updateStatus("In a meeting until 3pm")

User Settings and Notifications

getSettings
suspend fun → SceytResponse<UserSettings>
Fetches the current user’s server-side settings, such as global mute state and notification preferences.
when (val result = interactor.getSettings()) {
    is SceytResponse.Success -> applySettings(result.data)
    is SceytResponse.Error   -> handleError(result.exception)
}
muteNotifications
suspend fun → SceytResponse<Boolean>
Globally mutes all push notifications for the current user until the specified epoch timestamp in milliseconds.
// Mute for 8 hours
interactor.muteNotifications(System.currentTimeMillis() + 8.hours.inWholeMilliseconds)
unMuteNotifications
suspend fun → SceytResponse<Boolean>
Re-enables global push notifications for the current user.
interactor.unMuteNotifications()

Block List

blockUnBlockUser
suspend fun → SceytResponse<List<SceytUser>>
Blocks or unblocks a user. When block = true, the specified user is added to the current user’s block list and they can no longer send direct messages. When block = false, the block is removed.
// Block a user
interactor.blockUnBlockUser(userId = "user-abc", block = true)

// Unblock a user
interactor.blockUnBlockUser(userId = "user-abc", block = false)

Build docs developers (and LLMs) love