RoomService

interface RoomService

Inheritors

Properties

Link copied to clipboard
abstract val usersTyping: StateFlow<Map<RoomId, TypingEventContent>>

Functions

Link copied to clipboard
abstract suspend fun cancelSendMessage(roomId: RoomId, transactionId: String)
Link copied to clipboard
abstract suspend fun fillTimelineGaps(roomId: RoomId, startEventId: EventId, limit: Long = 20)
Link copied to clipboard
abstract suspend fun forgetRoom(roomId: RoomId, force: Boolean = false)

If the room has Membership.LEAVE, you can delete it locally.

Link copied to clipboard
abstract fun <C : RoomAccountDataEventContent> getAccountData(roomId: RoomId, eventContentClass: KClass<C>, key: String = ""): Flow<C?>
Link copied to clipboard
inline fun <C : RoomAccountDataEventContent> RoomService.getAccountData(roomId: RoomId, key: String = ""): Flow<C?>
Link copied to clipboard
abstract fun getAll(): Flow<Map<RoomId, Flow<Room?>>>

Upgraded rooms (Room.hasBeenReplaced) should not be rendered.

Link copied to clipboard
abstract fun <C : StateEventContent> getAllState(roomId: RoomId, eventContentClass: KClass<C>): Flow<Map<String, Flow<ClientEvent.StateBaseEvent<C>?>>>
Link copied to clipboard
Link copied to clipboard
abstract fun getById(roomId: RoomId): Flow<Room?>
Link copied to clipboard
abstract fun getLastTimelineEvent(roomId: RoomId, config: GetTimelineEventConfig.() -> Unit = {}): Flow<Flow<TimelineEvent>?>
Link copied to clipboard
abstract fun getLastTimelineEvents(roomId: RoomId, config: GetTimelineEventsConfig.() -> Unit = {}): Flow<Flow<Flow<TimelineEvent>>?>

Returns the last timeline events as flow.

Link copied to clipboard
abstract fun getNextTimelineEvent(event: TimelineEvent, config: GetTimelineEventConfig.() -> Unit = {}): Flow<TimelineEvent?>?
Link copied to clipboard
abstract fun getOutbox(): Flow<List<Flow<RoomOutboxMessage<*>?>>>
abstract fun getOutbox(roomId: RoomId): Flow<List<Flow<RoomOutboxMessage<*>?>>>
abstract fun getOutbox(roomId: RoomId, transactionId: String): Flow<RoomOutboxMessage<*>?>
Link copied to clipboard
abstract fun getPreviousTimelineEvent(event: TimelineEvent, config: GetTimelineEventConfig.() -> Unit = {}): Flow<TimelineEvent?>?
Link copied to clipboard
abstract fun <C : StateEventContent> getState(roomId: RoomId, eventContentClass: KClass<C>, stateKey: String = ""): Flow<ClientEvent.StateBaseEvent<C>?>
Link copied to clipboard
inline fun <C : StateEventContent> RoomService.getState(roomId: RoomId, stateKey: String = ""): Flow<ClientEvent.StateBaseEvent<C>?>
Link copied to clipboard
abstract fun <T> getTimeline(onStateChange: suspend (TimelineStateChange<T>) -> Unit = {}, transformer: suspend (Flow<TimelineEvent>) -> T): Timeline<T>

Returns a Timeline for a room.

Link copied to clipboard
fun RoomService.getTimeline(onStateChange: suspend (TimelineStateChange<Flow<TimelineEvent>>) -> Unit = {}): SimpleTimeline
Link copied to clipboard
abstract fun getTimelineEvent(roomId: RoomId, eventId: EventId, config: GetTimelineEventConfig.() -> Unit = {}): Flow<TimelineEvent?>

Returns the TimelineEvent and starts decryption. If it is not found locally, the algorithm will try to find the event by traversing the events from the end of the timeline (i.e. from the last sent event). This can include filling sync gaps from the server and thus might take a while. Please consider changing the config.

Link copied to clipboard
abstract fun getTimelineEventRelations(roomId: RoomId, eventId: EventId, relationType: RelationType): Flow<Map<EventId, Flow<TimelineEventRelation?>>?>
Link copied to clipboard
abstract fun getTimelineEvents(response: Sync.Response, decryptionTimeout: Duration = 30.seconds): Flow<TimelineEvent>

abstract fun getTimelineEvents(roomId: RoomId, startFrom: EventId, direction: GetEvents.Direction = BACKWARDS, config: GetTimelineEventsConfig.() -> Unit = {}): Flow<Flow<TimelineEvent>>

Returns a flow of timeline events wrapped in a flow. It emits, when there is a new timeline event. This flow only completes, when the start of the timeline is reached or GetTimelineEventsConfig.minSize and/or GetTimelineEventsConfig.maxSize are set and reached.

Link copied to clipboard
suspend fun RoomService.getTimelineEventsAround(roomId: RoomId, startFrom: EventId, configStart: GetTimelineEventConfig.() -> Unit = {}, configBefore: GetTimelineEventsConfig.() -> Unit = {}, configAfter: GetTimelineEventsConfig.() -> Unit = {}): List<Flow<TimelineEvent>>

Returns all timeline events around a starting event.

fun RoomService.getTimelineEventsAround(roomId: RoomId, startFrom: EventId, maxSizeBefore: StateFlow<Int>, maxSizeAfter: StateFlow<Int>, configStart: GetTimelineEventConfig.() -> Unit = {}, configBefore: GetTimelineEventsConfig.() -> Unit = {}, configAfter: GetTimelineEventsConfig.() -> Unit = {}): Flow<List<Flow<TimelineEvent>>>

Returns all timeline events around a starting event sorted with higher indexes being more recent.

Link copied to clipboard
abstract fun getTimelineEventsFromNowOn(decryptionTimeout: Duration = 30.seconds, syncResponseBufferSize: Int = 4): Flow<TimelineEvent>

Returns all timeline events from the moment this method is called. This also triggers decryption for each timeline event.

Link copied to clipboard
abstract suspend fun retrySendMessage(roomId: RoomId, transactionId: String)
Link copied to clipboard
abstract suspend fun sendMessage(roomId: RoomId, keepMediaInCache: Boolean = true, builder: suspend MessageBuilder.() -> Unit): String

Puts a message to the outbox.