diff --git a/buildSrc/src/main/kotlin/BuildVersionsSDK.kt b/buildSrc/src/main/kotlin/BuildVersionsSDK.kt index 98f2772..218a03b 100644 --- a/buildSrc/src/main/kotlin/BuildVersionsSDK.kt +++ b/buildSrc/src/main/kotlin/BuildVersionsSDK.kt @@ -1,5 +1,5 @@ object BuildVersionsSDK { const val majorVersion = 0 const val minorVersion = 1 - const val patchVersion = 98 + const val patchVersion = 99 } diff --git a/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt b/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt index 9ed947d..57fefc6 100644 --- a/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt +++ b/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt @@ -38,7 +38,9 @@ import kotlin.coroutines.resume import kotlinx.coroutines.CancellableContinuation import kotlinx.coroutines.suspendCancellableCoroutine import uniffi.matrix_sdk.FfiConverterTypeRoomMemberRole +import uniffi.matrix_sdk.FfiConverterTypeRoomPowerLevelChanges import uniffi.matrix_sdk.RoomMemberRole +import uniffi.matrix_sdk.RoomPowerLevelChanges import uniffi.matrix_sdk_base.FfiConverterTypeRoomNotableTags import uniffi.matrix_sdk_base.RoomNotableTags import uniffi.matrix_sdk_ui.BackPaginationStatus @@ -46,6 +48,7 @@ import uniffi.matrix_sdk_ui.EventItemOrigin import uniffi.matrix_sdk_ui.FfiConverterTypeBackPaginationStatus import uniffi.matrix_sdk_ui.FfiConverterTypeEventItemOrigin import uniffi.matrix_sdk.RustBuffer as RustBufferRoomMemberRole +import uniffi.matrix_sdk.RustBuffer as RustBufferRoomPowerLevelChanges import uniffi.matrix_sdk_base.RustBuffer as RustBufferRoomNotableTags import uniffi.matrix_sdk_ui.RustBuffer as RustBufferBackPaginationStatus import uniffi.matrix_sdk_ui.RustBuffer as RustBufferEventItemOrigin @@ -734,10 +737,14 @@ internal interface UniffiLib : Library { ): RustBuffer.ByValue fun uniffi_matrix_sdk_ffi_fn_method_room_alternative_aliases(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue + fun uniffi_matrix_sdk_ffi_fn_method_room_apply_power_level_changes(`ptr`: Pointer,`changes`: RustBufferRoomPowerLevelChanges.ByValue, + ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_room_avatar_url(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue fun uniffi_matrix_sdk_ffi_fn_method_room_ban_user(`ptr`: Pointer,`userId`: RustBuffer.ByValue,`reason`: RustBuffer.ByValue, ): Pointer + fun uniffi_matrix_sdk_ffi_fn_method_room_build_power_level_changes_from_current(`ptr`: Pointer, + ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_room_can_user_ban(`ptr`: Pointer,`userId`: RustBuffer.ByValue, ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_room_can_user_invite(`ptr`: Pointer,`userId`: RustBuffer.ByValue, @@ -818,6 +825,10 @@ internal interface UniffiLib : Library { ): Unit fun uniffi_matrix_sdk_ffi_fn_method_room_room_info(`ptr`: Pointer, ): Pointer + fun uniffi_matrix_sdk_ffi_fn_method_room_set_is_favorite(`ptr`: Pointer,`isFavorite`: Byte,`tagOrder`: RustBuffer.ByValue, + ): Pointer + fun uniffi_matrix_sdk_ffi_fn_method_room_set_is_low_priority(`ptr`: Pointer,`isLowPriority`: Byte,`tagOrder`: RustBuffer.ByValue, + ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_room_set_name(`ptr`: Pointer,`name`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Unit fun uniffi_matrix_sdk_ffi_fn_method_room_set_topic(`ptr`: Pointer,`topic`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -836,6 +847,8 @@ internal interface UniffiLib : Library { ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_room_unban_user(`ptr`: Pointer,`userId`: RustBuffer.ByValue,`reason`: RustBuffer.ByValue, ): Pointer + fun uniffi_matrix_sdk_ffi_fn_method_room_update_power_level_for_user(`ptr`: Pointer,`userId`: RustBuffer.ByValue,`powerLevel`: Long, + ): Pointer fun uniffi_matrix_sdk_ffi_fn_method_room_upload_avatar(`ptr`: Pointer,`mimeType`: RustBuffer.ByValue,`data`: RustBuffer.ByValue,`mediaInfo`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Unit fun uniffi_matrix_sdk_ffi_fn_clone_roomlist(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus, @@ -1626,10 +1639,14 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_alternative_aliases( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_room_apply_power_level_changes( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_avatar_url( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_ban_user( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_room_build_power_level_changes_from_current( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_can_user_ban( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_can_user_invite( @@ -1710,6 +1727,10 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_room_info( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_room_set_is_favorite( + ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_room_set_is_low_priority( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_set_name( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_set_topic( @@ -1728,6 +1749,8 @@ internal interface UniffiLib : Library { ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_unban_user( ): Short + fun uniffi_matrix_sdk_ffi_checksum_method_room_update_power_level_for_user( + ): Short fun uniffi_matrix_sdk_ffi_checksum_method_room_upload_avatar( ): Short fun uniffi_matrix_sdk_ffi_checksum_method_roomlist_entries( @@ -2461,12 +2484,18 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_alternative_aliases() != 28555.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_apply_power_level_changes() != 41062.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_avatar_url() != 34637.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_ban_user() != 25865.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_build_power_level_changes_from_current() != 13995.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_can_user_ban() != 22009.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -2587,6 +2616,12 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_room_info() != 41146.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_set_is_favorite() != 61829.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_set_is_low_priority() != 47223.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_set_name() != 60145.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -2614,6 +2649,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) { if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_unban_user() != 51089.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_update_power_level_for_user() != 61757.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_matrix_sdk_ffi_checksum_method_room_upload_avatar() != 34800.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -6833,10 +6871,14 @@ public interface RoomInterface { fun `alternativeAliases`(): List + suspend fun `applyPowerLevelChanges`(`changes`: RoomPowerLevelChanges) + fun `avatarUrl`(): String? suspend fun `banUser`(`userId`: String, `reason`: String?) + suspend fun `buildPowerLevelChangesFromCurrent`(): RoomPowerLevelChanges + suspend fun `canUserBan`(`userId`: String): Boolean suspend fun `canUserInvite`(`userId`: String): Boolean @@ -6977,6 +7019,10 @@ public interface RoomInterface { suspend fun `roomInfo`(): RoomInfo + suspend fun `setIsFavorite`(`isFavorite`: Boolean, `tagOrder`: Double?) + + suspend fun `setIsLowPriority`(`isLowPriority`: Boolean, `tagOrder`: Double?) + /** * Sets a new name to the room. */ @@ -7001,6 +7047,8 @@ public interface RoomInterface { suspend fun `unbanUser`(`userId`: String, `reason`: String?) + suspend fun `updatePowerLevelForUser`(`userId`: String, `powerLevel`: Long) + /** * Upload and set the room's avatar. * @@ -7098,6 +7146,27 @@ open class Room : FFIObject, RoomInterface { FfiConverterSequenceString.lift(it) } + + @Throws(ClientException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `applyPowerLevelChanges`(`changes`: RoomPowerLevelChanges) { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_room_apply_power_level_changes( + thisPtr, + FfiConverterTypeRoomPowerLevelChanges.lower(`changes`), + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_void(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_void(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_void(future) }, + // lift function + { Unit }, + + // Error FFI converter + ClientException.ErrorHandler, + ) + } override fun `avatarUrl`(): String? = callWithPointer { uniffiRustCall() { _status -> @@ -7131,6 +7200,26 @@ open class Room : FFIObject, RoomInterface { ) } + @Throws(ClientException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `buildPowerLevelChangesFromCurrent`() : RoomPowerLevelChanges { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_room_build_power_level_changes_from_current( + thisPtr, + + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer(future, continuation).let { RustBufferRoomPowerLevelChanges.create(it.capacity, it.len, it.data) } }, + { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_rust_buffer(future) }, + // lift function + { FfiConverterTypeRoomPowerLevelChanges.lift(it) }, + // Error FFI converter + ClientException.ErrorHandler, + ) + } + @Throws(ClientException::class) @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") override suspend fun `canUserBan`(`userId`: String) : Boolean { @@ -7783,6 +7872,48 @@ open class Room : FFIObject, RoomInterface { ) } + @Throws(ClientException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `setIsFavorite`(`isFavorite`: Boolean, `tagOrder`: Double?) { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_room_set_is_favorite( + thisPtr, + FfiConverterBoolean.lower(`isFavorite`),FfiConverterOptionalDouble.lower(`tagOrder`), + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_void(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_void(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_void(future) }, + // lift function + { Unit }, + + // Error FFI converter + ClientException.ErrorHandler, + ) + } + + @Throws(ClientException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `setIsLowPriority`(`isLowPriority`: Boolean, `tagOrder`: Double?) { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_room_set_is_low_priority( + thisPtr, + FfiConverterBoolean.lower(`isLowPriority`),FfiConverterOptionalDouble.lower(`tagOrder`), + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_void(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_void(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_void(future) }, + // lift function + { Unit }, + + // Error FFI converter + ClientException.ErrorHandler, + ) + } + /** * Sets a new name to the room. */ @@ -7925,6 +8056,27 @@ open class Room : FFIObject, RoomInterface { ) } + @Throws(ClientException::class) + @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE") + override suspend fun `updatePowerLevelForUser`(`userId`: String, `powerLevel`: Long) { + return uniffiRustCallAsync( + callWithPointer { thisPtr -> + UniffiLib.INSTANCE.uniffi_matrix_sdk_ffi_fn_method_room_update_power_level_for_user( + thisPtr, + FfiConverterString.lower(`userId`),FfiConverterLong.lower(`powerLevel`), + ) + }, + { future, callback, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_poll_void(future, callback, continuation) }, + { future, continuation -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_complete_void(future, continuation) }, + { future -> UniffiLib.INSTANCE.ffi_matrix_sdk_ffi_rust_future_free_void(future) }, + // lift function + { Unit }, + + // Error FFI converter + ClientException.ErrorHandler, + ) + } + /** * Upload and set the room's avatar. * @@ -17388,11 +17540,32 @@ public object FfiConverterTypeRoomError : FfiConverterRustBuffer sealed class RoomListEntriesDynamicFilterKind { - object All : RoomListEntriesDynamicFilterKind() + data class All( + + val `filters`: List + ) : RoomListEntriesDynamicFilterKind() { + companion object + } + + data class Any( + + val `filters`: List + ) : RoomListEntriesDynamicFilterKind() { + companion object + } + object NonLeft : RoomListEntriesDynamicFilterKind() - object AllNonLeft : RoomListEntriesDynamicFilterKind() + object Unread : RoomListEntriesDynamicFilterKind() + + + data class Category( + + val `expect`: RoomListFilterCategory + ) : RoomListEntriesDynamicFilterKind() { + companion object + } object None : RoomListEntriesDynamicFilterKind() @@ -17419,13 +17592,22 @@ sealed class RoomListEntriesDynamicFilterKind { public object FfiConverterTypeRoomListEntriesDynamicFilterKind : FfiConverterRustBuffer{ override fun read(buf: ByteBuffer): RoomListEntriesDynamicFilterKind { return when(buf.getInt()) { - 1 -> RoomListEntriesDynamicFilterKind.All - 2 -> RoomListEntriesDynamicFilterKind.AllNonLeft - 3 -> RoomListEntriesDynamicFilterKind.None - 4 -> RoomListEntriesDynamicFilterKind.NormalizedMatchRoomName( + 1 -> RoomListEntriesDynamicFilterKind.All( + FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.read(buf), + ) + 2 -> RoomListEntriesDynamicFilterKind.Any( + FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.read(buf), + ) + 3 -> RoomListEntriesDynamicFilterKind.NonLeft + 4 -> RoomListEntriesDynamicFilterKind.Unread + 5 -> RoomListEntriesDynamicFilterKind.Category( + FfiConverterTypeRoomListFilterCategory.read(buf), + ) + 6 -> RoomListEntriesDynamicFilterKind.None + 7 -> RoomListEntriesDynamicFilterKind.NormalizedMatchRoomName( FfiConverterString.read(buf), ) - 5 -> RoomListEntriesDynamicFilterKind.FuzzyMatchRoomName( + 8 -> RoomListEntriesDynamicFilterKind.FuzzyMatchRoomName( FfiConverterString.read(buf), ) else -> throw RuntimeException("invalid enum value, something is very wrong!!") @@ -17437,12 +17619,33 @@ public object FfiConverterTypeRoomListEntriesDynamicFilterKind : FfiConverterRus // Add the size for the Int that specifies the variant plus the size needed for all fields ( 4 + + FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.allocationSize(value.`filters`) ) } - is RoomListEntriesDynamicFilterKind.AllNonLeft -> { + is RoomListEntriesDynamicFilterKind.Any -> { // Add the size for the Int that specifies the variant plus the size needed for all fields ( 4 + + FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.allocationSize(value.`filters`) + ) + } + is RoomListEntriesDynamicFilterKind.NonLeft -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4 + ) + } + is RoomListEntriesDynamicFilterKind.Unread -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4 + ) + } + is RoomListEntriesDynamicFilterKind.Category -> { + // Add the size for the Int that specifies the variant plus the size needed for all fields + ( + 4 + + FfiConverterTypeRoomListFilterCategory.allocationSize(value.`expect`) ) } is RoomListEntriesDynamicFilterKind.None -> { @@ -17471,23 +17674,38 @@ public object FfiConverterTypeRoomListEntriesDynamicFilterKind : FfiConverterRus when(value) { is RoomListEntriesDynamicFilterKind.All -> { buf.putInt(1) + FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.write(value.`filters`, buf) Unit } - is RoomListEntriesDynamicFilterKind.AllNonLeft -> { + is RoomListEntriesDynamicFilterKind.Any -> { buf.putInt(2) + FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.write(value.`filters`, buf) Unit } - is RoomListEntriesDynamicFilterKind.None -> { + is RoomListEntriesDynamicFilterKind.NonLeft -> { buf.putInt(3) Unit } - is RoomListEntriesDynamicFilterKind.NormalizedMatchRoomName -> { + is RoomListEntriesDynamicFilterKind.Unread -> { buf.putInt(4) + Unit + } + is RoomListEntriesDynamicFilterKind.Category -> { + buf.putInt(5) + FfiConverterTypeRoomListFilterCategory.write(value.`expect`, buf) + Unit + } + is RoomListEntriesDynamicFilterKind.None -> { + buf.putInt(6) + Unit + } + is RoomListEntriesDynamicFilterKind.NormalizedMatchRoomName -> { + buf.putInt(7) FfiConverterString.write(value.`pattern`, buf) Unit } is RoomListEntriesDynamicFilterKind.FuzzyMatchRoomName -> { - buf.putInt(5) + buf.putInt(8) FfiConverterString.write(value.`pattern`, buf) Unit } @@ -18036,6 +18254,31 @@ public object FfiConverterTypeRoomListError : FfiConverterRustBuffer { + override fun read(buf: ByteBuffer) = try { + RoomListFilterCategory.values()[buf.getInt() - 1] + } catch (e: IndexOutOfBoundsException) { + throw RuntimeException("invalid enum value, something is very wrong!!", e) + } + + override fun allocationSize(value: RoomListFilterCategory) = 4 + + override fun write(value: RoomListFilterCategory, buf: ByteBuffer) { + buf.putInt(value.ordinal + 1) + } +} + + + + + sealed class RoomListInput { data class Viewport( @@ -23468,6 +23711,31 @@ public object FfiConverterSequenceTypeFilterTimelineEventType: FfiConverterRustB +public object FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind: FfiConverterRustBuffer> { + override fun read(buf: ByteBuffer): List { + val len = buf.getInt() + return List(len) { + FfiConverterTypeRoomListEntriesDynamicFilterKind.read(buf) + } + } + + override fun allocationSize(value: List): Int { + val sizeForLength = 4 + val sizeForItems = value.map { FfiConverterTypeRoomListEntriesDynamicFilterKind.allocationSize(it) }.sum() + return sizeForLength + sizeForItems + } + + override fun write(value: List, buf: ByteBuffer) { + buf.putInt(value.size) + value.forEach { + FfiConverterTypeRoomListEntriesDynamicFilterKind.write(it, buf) + } + } +} + + + + public object FfiConverterSequenceTypeRoomListEntriesUpdate: FfiConverterRustBuffer> { override fun read(buf: ByteBuffer): List { val len = buf.getInt() @@ -23695,6 +23963,10 @@ public object FfiConverterMapStringSequenceString: FfiConverterRustBuffer T.use(block: (T) -> R) = } } +public object FfiConverterLong: FfiConverter { + override fun lift(value: Long): Long { + return value + } + + override fun read(buf: ByteBuffer): Long { + return buf.getLong() + } + + override fun lower(value: Long): Long { + return value + } + + override fun allocationSize(value: Long) = 8 + + override fun write(value: Long, buf: ByteBuffer) { + buf.putLong(value) + } +} + public object FfiConverterString: FfiConverter { // Note: we don't inherit from FfiConverterRustBuffer, because we use a // special encoding when lowering/lifting. We can use `RustBuffer.len` to @@ -604,6 +624,102 @@ public object FfiConverterString: FfiConverter { +/** + * A set of common power levels required for various operations within a room, + * that can be applied as a single operation. When updating these + * settings, any levels that are `None` will remain unchanged. + */ +data class RoomPowerLevelChanges ( + /** + * The level required to ban a user. + */ + var `ban`: Long? = null, + /** + * The level required to invite a user. + */ + var `invite`: Long? = null, + /** + * The level required to kick a user. + */ + var `kick`: Long? = null, + /** + * The level required to redact an event. + */ + var `redact`: Long? = null, + /** + * The default level required to send message events. + */ + var `eventsDefault`: Long? = null, + /** + * The default level required to send state events. + */ + var `stateDefault`: Long? = null, + /** + * The default power level for every user in the room. + */ + var `usersDefault`: Long? = null, + /** + * The level required to change the room's name. + */ + var `roomName`: Long? = null, + /** + * The level required to change the room's avatar. + */ + var `roomAvatar`: Long? = null, + /** + * The level required to change the room's topic. + */ + var `roomTopic`: Long? = null +) { + + companion object +} + +public object FfiConverterTypeRoomPowerLevelChanges: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): RoomPowerLevelChanges { + return RoomPowerLevelChanges( + FfiConverterOptionalLong.read(buf), + FfiConverterOptionalLong.read(buf), + FfiConverterOptionalLong.read(buf), + FfiConverterOptionalLong.read(buf), + FfiConverterOptionalLong.read(buf), + FfiConverterOptionalLong.read(buf), + FfiConverterOptionalLong.read(buf), + FfiConverterOptionalLong.read(buf), + FfiConverterOptionalLong.read(buf), + FfiConverterOptionalLong.read(buf), + ) + } + + override fun allocationSize(value: RoomPowerLevelChanges) = ( + FfiConverterOptionalLong.allocationSize(value.`ban`) + + FfiConverterOptionalLong.allocationSize(value.`invite`) + + FfiConverterOptionalLong.allocationSize(value.`kick`) + + FfiConverterOptionalLong.allocationSize(value.`redact`) + + FfiConverterOptionalLong.allocationSize(value.`eventsDefault`) + + FfiConverterOptionalLong.allocationSize(value.`stateDefault`) + + FfiConverterOptionalLong.allocationSize(value.`usersDefault`) + + FfiConverterOptionalLong.allocationSize(value.`roomName`) + + FfiConverterOptionalLong.allocationSize(value.`roomAvatar`) + + FfiConverterOptionalLong.allocationSize(value.`roomTopic`) + ) + + override fun write(value: RoomPowerLevelChanges, buf: ByteBuffer) { + FfiConverterOptionalLong.write(value.`ban`, buf) + FfiConverterOptionalLong.write(value.`invite`, buf) + FfiConverterOptionalLong.write(value.`kick`, buf) + FfiConverterOptionalLong.write(value.`redact`, buf) + FfiConverterOptionalLong.write(value.`eventsDefault`, buf) + FfiConverterOptionalLong.write(value.`stateDefault`, buf) + FfiConverterOptionalLong.write(value.`usersDefault`, buf) + FfiConverterOptionalLong.write(value.`roomName`, buf) + FfiConverterOptionalLong.write(value.`roomAvatar`, buf) + FfiConverterOptionalLong.write(value.`roomTopic`, buf) + } +} + + + /** * The role of a member in a room. */ @@ -640,3 +756,32 @@ public object FfiConverterTypeRoomMemberRole: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): Long? { + if (buf.get().toInt() == 0) { + return null + } + return FfiConverterLong.read(buf) + } + + override fun allocationSize(value: Long?): Int { + if (value == null) { + return 1 + } else { + return 1 + FfiConverterLong.allocationSize(value) + } + } + + override fun write(value: Long?, buf: ByteBuffer) { + if (value == null) { + buf.put(0) + } else { + buf.put(1) + FfiConverterLong.write(value, buf) + } + } +} + diff --git a/sdk/sdk-android/src/main/kotlin/uniffi/matrix_sdk_base/matrix_sdk_base.kt b/sdk/sdk-android/src/main/kotlin/uniffi/matrix_sdk_base/matrix_sdk_base.kt index 3c8f98d..031dad4 100644 --- a/sdk/sdk-android/src/main/kotlin/uniffi/matrix_sdk_base/matrix_sdk_base.kt +++ b/sdk/sdk-android/src/main/kotlin/uniffi/matrix_sdk_base/matrix_sdk_base.kt @@ -631,7 +631,11 @@ data class RoomNotableTags ( /** * Whether or not the room is marked as favorite. */ - var `isFavorite`: Boolean + var `isFavorite`: Boolean, + /** + * Whether or not the room is marked as low priority. + */ + var `isLowPriority`: Boolean ) { companion object @@ -641,15 +645,18 @@ public object FfiConverterTypeRoomNotableTags: FfiConverterRustBuffer