@@ -838,6 +838,11 @@ public protocol ClientProtocol : AnyObject {
838838
839839 func getRecentlyVisitedRooms() async throws -> [String]
840840
841+ /**
842+ * Get the preview of a room, to interact with it.
843+ */
844+ func getRoomPreview(roomIdOrAlias: String) async throws -> RoomPreview
845+
841846 func getSessionVerificationController() throws -> SessionVerificationController
842847
843848 /**
@@ -867,6 +872,11 @@ public protocol ClientProtocol : AnyObject {
867872
868873 func removeAvatar() throws
869874
875+ /**
876+ * Resolves the given room alias to a room id, if possible.
877+ */
878+ func resolveRoomAlias(roomAlias: String) async throws -> String
879+
870880 /**
871881 * Restores the client from a `Session`.
872882 */
@@ -1158,6 +1168,26 @@ open class Client:
11581168 }
11591169
11601170
1171+ /**
1172+ * Get the preview of a room, to interact with it.
1173+ */
1174+ open func getRoomPreview(roomIdOrAlias: String) async throws -> RoomPreview {
1175+ return try await uniffiRustCallAsync(
1176+ rustFutureFunc: {
1177+ uniffi_matrix_sdk_ffi_fn_method_client_get_room_preview(
1178+ self.uniffiClonePointer(),
1179+ FfiConverterString.lower(roomIdOrAlias)
1180+ )
1181+ },
1182+ pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
1183+ completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
1184+ freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
1185+ liftFunc: FfiConverterTypeRoomPreview.lift,
1186+ errorHandler: FfiConverterTypeClientError.lift
1187+ )
1188+ }
1189+
1190+
11611191 open func getSessionVerificationController() throws -> SessionVerificationController {
11621192 return try FfiConverterTypeSessionVerificationController.lift(
11631193 try
@@ -1284,6 +1314,26 @@ open class Client:
12841314 )
12851315}
12861316 }
1317+ /**
1318+ * Resolves the given room alias to a room id, if possible.
1319+ */
1320+ open func resolveRoomAlias(roomAlias: String) async throws -> String {
1321+ return try await uniffiRustCallAsync(
1322+ rustFutureFunc: {
1323+ uniffi_matrix_sdk_ffi_fn_method_client_resolve_room_alias(
1324+ self.uniffiClonePointer(),
1325+ FfiConverterString.lower(roomAlias)
1326+ )
1327+ },
1328+ pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
1329+ completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
1330+ freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
1331+ liftFunc: FfiConverterString.lift,
1332+ errorHandler: FfiConverterTypeClientError.lift
1333+ )
1334+ }
1335+
1336+
12871337 /**
12881338 * Restores the client from a `Session`.
12891339 */
@@ -12047,6 +12097,217 @@ public func FfiConverterTypeRoomPowerLevels_lower(_ value: RoomPowerLevels) -> R
1204712097}
1204812098
1204912099
12100+ /**
12101+ * The preview of a room, be it invited/joined/left, or not.
12102+ */
12103+ public struct RoomPreview {
12104+ /**
12105+ * The room id for this room.
12106+ */
12107+ public var roomId: String
12108+ /**
12109+ * The canonical alias for the room.
12110+ */
12111+ public var canonicalAlias: String?
12112+ /**
12113+ * The room's name, if set.
12114+ */
12115+ public var name: String?
12116+ /**
12117+ * The room's topic, if set.
12118+ */
12119+ public var topic: String?
12120+ /**
12121+ * The MXC URI to the room's avatar, if set.
12122+ */
12123+ public var avatarUrl: String?
12124+ /**
12125+ * The number of joined members.
12126+ */
12127+ public var numJoinedMembers: UInt64
12128+ /**
12129+ * The room type (space, custom) or nothing, if it's a regular room.
12130+ */
12131+ public var roomType: String?
12132+ /**
12133+ * Is the history world-readable for this room?
12134+ */
12135+ public var isHistoryWorldReadable: Bool
12136+ /**
12137+ * Is the room joined by the current user?
12138+ */
12139+ public var isJoined: Bool
12140+ /**
12141+ * Is the current user invited to this room?
12142+ */
12143+ public var isInvited: Bool
12144+ /**
12145+ * is the join rule public for this room?
12146+ */
12147+ public var isPublic: Bool
12148+ /**
12149+ * Can we knock (or restricted-knock) to this room?
12150+ */
12151+ public var canKnock: Bool
12152+
12153+ // Default memberwise initializers are never public by default, so we
12154+ // declare one manually.
12155+ public init(
12156+ /**
12157+ * The room id for this room.
12158+ */roomId: String,
12159+ /**
12160+ * The canonical alias for the room.
12161+ */canonicalAlias: String?,
12162+ /**
12163+ * The room's name, if set.
12164+ */name: String?,
12165+ /**
12166+ * The room's topic, if set.
12167+ */topic: String?,
12168+ /**
12169+ * The MXC URI to the room's avatar, if set.
12170+ */avatarUrl: String?,
12171+ /**
12172+ * The number of joined members.
12173+ */numJoinedMembers: UInt64,
12174+ /**
12175+ * The room type (space, custom) or nothing, if it's a regular room.
12176+ */roomType: String?,
12177+ /**
12178+ * Is the history world-readable for this room?
12179+ */isHistoryWorldReadable: Bool,
12180+ /**
12181+ * Is the room joined by the current user?
12182+ */isJoined: Bool,
12183+ /**
12184+ * Is the current user invited to this room?
12185+ */isInvited: Bool,
12186+ /**
12187+ * is the join rule public for this room?
12188+ */isPublic: Bool,
12189+ /**
12190+ * Can we knock (or restricted-knock) to this room?
12191+ */canKnock: Bool) {
12192+ self.roomId = roomId
12193+ self.canonicalAlias = canonicalAlias
12194+ self.name = name
12195+ self.topic = topic
12196+ self.avatarUrl = avatarUrl
12197+ self.numJoinedMembers = numJoinedMembers
12198+ self.roomType = roomType
12199+ self.isHistoryWorldReadable = isHistoryWorldReadable
12200+ self.isJoined = isJoined
12201+ self.isInvited = isInvited
12202+ self.isPublic = isPublic
12203+ self.canKnock = canKnock
12204+ }
12205+ }
12206+
12207+
12208+ extension RoomPreview: Equatable, Hashable {
12209+ public static func ==(lhs: RoomPreview, rhs: RoomPreview) -> Bool {
12210+ if lhs.roomId != rhs.roomId {
12211+ return false
12212+ }
12213+ if lhs.canonicalAlias != rhs.canonicalAlias {
12214+ return false
12215+ }
12216+ if lhs.name != rhs.name {
12217+ return false
12218+ }
12219+ if lhs.topic != rhs.topic {
12220+ return false
12221+ }
12222+ if lhs.avatarUrl != rhs.avatarUrl {
12223+ return false
12224+ }
12225+ if lhs.numJoinedMembers != rhs.numJoinedMembers {
12226+ return false
12227+ }
12228+ if lhs.roomType != rhs.roomType {
12229+ return false
12230+ }
12231+ if lhs.isHistoryWorldReadable != rhs.isHistoryWorldReadable {
12232+ return false
12233+ }
12234+ if lhs.isJoined != rhs.isJoined {
12235+ return false
12236+ }
12237+ if lhs.isInvited != rhs.isInvited {
12238+ return false
12239+ }
12240+ if lhs.isPublic != rhs.isPublic {
12241+ return false
12242+ }
12243+ if lhs.canKnock != rhs.canKnock {
12244+ return false
12245+ }
12246+ return true
12247+ }
12248+
12249+ public func hash(into hasher: inout Hasher) {
12250+ hasher.combine(roomId)
12251+ hasher.combine(canonicalAlias)
12252+ hasher.combine(name)
12253+ hasher.combine(topic)
12254+ hasher.combine(avatarUrl)
12255+ hasher.combine(numJoinedMembers)
12256+ hasher.combine(roomType)
12257+ hasher.combine(isHistoryWorldReadable)
12258+ hasher.combine(isJoined)
12259+ hasher.combine(isInvited)
12260+ hasher.combine(isPublic)
12261+ hasher.combine(canKnock)
12262+ }
12263+ }
12264+
12265+
12266+ public struct FfiConverterTypeRoomPreview: FfiConverterRustBuffer {
12267+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomPreview {
12268+ return
12269+ try RoomPreview(
12270+ roomId: FfiConverterString.read(from: &buf),
12271+ canonicalAlias: FfiConverterOptionString.read(from: &buf),
12272+ name: FfiConverterOptionString.read(from: &buf),
12273+ topic: FfiConverterOptionString.read(from: &buf),
12274+ avatarUrl: FfiConverterOptionString.read(from: &buf),
12275+ numJoinedMembers: FfiConverterUInt64.read(from: &buf),
12276+ roomType: FfiConverterOptionString.read(from: &buf),
12277+ isHistoryWorldReadable: FfiConverterBool.read(from: &buf),
12278+ isJoined: FfiConverterBool.read(from: &buf),
12279+ isInvited: FfiConverterBool.read(from: &buf),
12280+ isPublic: FfiConverterBool.read(from: &buf),
12281+ canKnock: FfiConverterBool.read(from: &buf)
12282+ )
12283+ }
12284+
12285+ public static func write(_ value: RoomPreview, into buf: inout [UInt8]) {
12286+ FfiConverterString.write(value.roomId, into: &buf)
12287+ FfiConverterOptionString.write(value.canonicalAlias, into: &buf)
12288+ FfiConverterOptionString.write(value.name, into: &buf)
12289+ FfiConverterOptionString.write(value.topic, into: &buf)
12290+ FfiConverterOptionString.write(value.avatarUrl, into: &buf)
12291+ FfiConverterUInt64.write(value.numJoinedMembers, into: &buf)
12292+ FfiConverterOptionString.write(value.roomType, into: &buf)
12293+ FfiConverterBool.write(value.isHistoryWorldReadable, into: &buf)
12294+ FfiConverterBool.write(value.isJoined, into: &buf)
12295+ FfiConverterBool.write(value.isInvited, into: &buf)
12296+ FfiConverterBool.write(value.isPublic, into: &buf)
12297+ FfiConverterBool.write(value.canKnock, into: &buf)
12298+ }
12299+ }
12300+
12301+
12302+ public func FfiConverterTypeRoomPreview_lift(_ buf: RustBuffer) throws -> RoomPreview {
12303+ return try FfiConverterTypeRoomPreview.lift(buf)
12304+ }
12305+
12306+ public func FfiConverterTypeRoomPreview_lower(_ value: RoomPreview) -> RustBuffer {
12307+ return FfiConverterTypeRoomPreview.lower(value)
12308+ }
12309+
12310+
1205012311public struct RoomSubscription {
1205112312 public var requiredState: [RequiredState]?
1205212313 public var timelineLimit: UInt32?
@@ -23441,6 +23702,9 @@ private var initializationResult: InitializationResult {
2344123702 if (uniffi_matrix_sdk_ffi_checksum_method_client_get_recently_visited_rooms() != 22399) {
2344223703 return InitializationResult.apiChecksumMismatch
2344323704 }
23705+ if (uniffi_matrix_sdk_ffi_checksum_method_client_get_room_preview() != 16738) {
23706+ return InitializationResult.apiChecksumMismatch
23707+ }
2344423708 if (uniffi_matrix_sdk_ffi_checksum_method_client_get_session_verification_controller() != 62335) {
2344523709 return InitializationResult.apiChecksumMismatch
2344623710 }
@@ -23468,6 +23732,9 @@ private var initializationResult: InitializationResult {
2346823732 if (uniffi_matrix_sdk_ffi_checksum_method_client_remove_avatar() != 60365) {
2346923733 return InitializationResult.apiChecksumMismatch
2347023734 }
23735+ if (uniffi_matrix_sdk_ffi_checksum_method_client_resolve_room_alias() != 40454) {
23736+ return InitializationResult.apiChecksumMismatch
23737+ }
2347123738 if (uniffi_matrix_sdk_ffi_checksum_method_client_restore_session() != 19641) {
2347223739 return InitializationResult.apiChecksumMismatch
2347323740 }
0 commit comments