RoomService

interface RoomService

This interface defines methods to get rooms. It's implemented at the session level.

Functions

Link copied to clipboard
open suspend fun createDirectRoom(otherUserId: String): String

Create a direct room asynchronously. This is a facility method to create a direct room with the necessary parameters.

Link copied to clipboard
abstract suspend fun createLocalRoom(createRoomParams: CreateRoomParams): String

Create a room locally. This room will not be synchronized with the server and will not come back from the sync, so all the events related to this room will be generated locally.

Link copied to clipboard
abstract suspend fun createRoom(createRoomParams: CreateRoomParams): String

Create a room asynchronously.

Link copied to clipboard
abstract suspend fun deleteLocalRoom(roomId: String)

Delete a local room with all its related events.

Link copied to clipboard
abstract suspend fun deleteRoomAlias(roomAlias: String)

Delete a room alias.

Link copied to clipboard
abstract fun getBreadcrumbs(queryParams: RoomSummaryQueryParams): List<RoomSummary>

Get a snapshot list of Breadcrumbs.

Link copied to clipboard
abstract fun getBreadcrumbsLive(queryParams: RoomSummaryQueryParams): LiveData<List<RoomSummary>>

Get a live list of Breadcrumbs.

Link copied to clipboard
abstract fun getChangeMemberships(roomIdOrAlias: String): ChangeMembershipState

Return the current local changes membership for the given room. see getChangeMembershipsLive for more details.

Link copied to clipboard
abstract fun getChangeMembershipsLive(): LiveData<Map<String, ChangeMembershipState>>

Return a live data of all local changes membership that happened since the session has been opened. It allows you to track this in your client to known what is currently being processed by the SDK. It won't know anything about change being done in other client. Keys are roomId or roomAlias, depending of what you used as parameter for the join/leave action

Link copied to clipboard
abstract fun getExistingDirectRoomWithUser(otherUserId: String): String?

Return the roomId of an existing DM with the other user, or null if such room does not exist. A room is a DM if:

Link copied to clipboard
abstract fun getFilteredPagedRoomSummariesLive(    queryParams: RoomSummaryQueryParams,     pagedListConfig: PagedList.Config = defaultPagedListConfig,     sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): UpdatableLivePageResult

Get's a live paged list from a filter that can be dynamically updated.

Link copied to clipboard
abstract fun getFlattenRoomSummaryChildrenOf(spaceId: String?, memberships: List<Membership> = Membership.activeMemberships()): List<RoomSummary>
Link copied to clipboard
abstract fun getFlattenRoomSummaryChildrenOfLive(spaceId: String?, memberships: List<Membership> = Membership.activeMemberships()): LiveData<List<RoomSummary>>

Returns all the children of this space, as LiveData.

Link copied to clipboard
abstract fun getLocalRoomSummaryLive(roomId: String): LiveData<Optional<LocalRoomSummary>>

A live LocalRoomSummary associated with the room with id roomId. You can observe this summary to get dynamic data from this room, even if the room is not joined yet

Link copied to clipboard
abstract fun getNotificationCountForRooms(queryParams: RoomSummaryQueryParams): RoomAggregateNotificationCount

TODO Doc.

Link copied to clipboard
abstract fun getPagedRoomSummariesLive(    queryParams: RoomSummaryQueryParams,     pagedListConfig: PagedList.Config = defaultPagedListConfig,     sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): LiveData<PagedList<RoomSummary>>

TODO Doc.

Link copied to clipboard
abstract fun getRoom(roomId: String): Room?

Get a room from a roomId.

Link copied to clipboard
abstract fun getRoomCountLive(queryParams: RoomSummaryQueryParams): LiveData<Int>

Return a LiveData on the number of rooms.

Link copied to clipboard
abstract suspend fun getRoomIdByAlias(roomAlias: String, searchOnServer: Boolean): Optional<RoomAliasDescription>

Resolve a room alias to a room ID.

Link copied to clipboard
abstract fun getRoomMember(userId: String, roomId: String): RoomMemberSummary?

Get a room member for the tuple {userId,roomId}.

Link copied to clipboard
abstract fun getRoomMemberLive(userId: String, roomId: String): LiveData<Optional<RoomMemberSummary>>

Observe a live room member for the tuple {userId,roomId}.

Link copied to clipboard
abstract suspend fun getRoomState(roomId: String): List<Event>

Get some state events about a room.

Link copied to clipboard
abstract fun getRoomSummaries(queryParams: RoomSummaryQueryParams, sortOrder: RoomSortOrder = RoomSortOrder.NONE): List<RoomSummary>

Get a snapshot list of room summaries.

Link copied to clipboard
abstract fun getRoomSummariesLive(queryParams: RoomSummaryQueryParams, sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): LiveData<List<RoomSummary>>

Get a live list of room summaries. This list is refreshed as soon as the data changes.

Link copied to clipboard
abstract fun getRoomSummary(roomIdOrAlias: String): RoomSummary?

Get a roomSummary from a roomId or a room alias.

Link copied to clipboard
abstract fun getRoomSummaryLive(roomId: String): LiveData<Optional<RoomSummary>>

A live RoomSummary associated with the room with id roomId. You can observe this summary to get dynamic data from this room, even if the room is not joined yet

Link copied to clipboard
abstract suspend fun joinRoom(    roomIdOrAlias: String,     reason: String? = null,     viaServers: List<String> = emptyList())

Join a room by id.

abstract suspend fun joinRoom(    roomId: String,     reason: String? = null,     thirdPartySigned: SignInvitationResult)
Link copied to clipboard
abstract suspend fun leaveRoom(roomId: String, reason: String? = null)

Leave the room, or reject an invitation.

Link copied to clipboard
abstract suspend fun markAllAsRead(roomIds: List<String>)

Mark all rooms as read.

Link copied to clipboard
abstract suspend fun onRoomDisplayed(roomId: String)

Inform the Matrix SDK that a room is displayed. The SDK will update the breadcrumbs in the user account data

Link copied to clipboard
abstract suspend fun peekRoom(roomIdOrAlias: String): PeekResult

Use this if you want to get information from a room that you are not yet in (or invited). It might be possible to get some information on this room if it is public or if guest access is allowed. This call will try to gather some information on this room, but it could fail and get nothing more.

Link copied to clipboard
abstract fun refreshJoinedRoomSummaryPreviews(roomId: String?)

Refreshes the RoomSummary LatestPreviewContent for the given @param roomId. If the roomId is null, all rooms are updated.

Link copied to clipboard
abstract fun roomSummariesChangesLive(queryParams: RoomSummaryQueryParams, sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): LiveData<List<Unit>>

Only notifies when this query has changes. It doesn't load any items in memory