Add RoomMembershipDetails to get the room member info for the current user and the sender of its m.room.member state event in the room.

This commit is contained in:
Jorge Martín
2025-02-10 16:20:34 +01:00
committed by Jorge Martin Espinosa
parent 311fbb84f7
commit 02addf54dd
11 changed files with 101 additions and 17 deletions

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.libraries.matrix.api.room
/**
* Room membership details for the current user and the sender of the membership event.
*
* It also includes the reason the current user's membership changed, if any.
*/
data class RoomMembershipDetails(
val currentUserMember: RoomMember,
val senderMember: RoomMember?,
) {
val membershipChangeReason: String? = currentUserMember.membershipChangeReason
}

View File

@@ -22,4 +22,9 @@ interface RoomPreview : AutoCloseable {
* Forget the room if we had access to it, and it was left or banned.
*/
suspend fun forget(): Result<Unit>
/**
* Get the membership details of the user in the room, as well as from the user who sent the `m.room.member` event.
*/
suspend fun membershipDetails(): Result<RoomMembershipDetails?>
}