@@ -10707,6 +10707,108 @@ public func FfiConverterTypeTaskHandle_lower(_ value: TaskHandle) -> UnsafeMutab
10707
10707
10708
10708
10709
10709
10710
+ public protocol ThreadSummaryProtocol : AnyObject {
10711
+
10712
+ func latestEvent() -> ThreadSummaryLatestEventDetails
10713
+
10714
+ }
10715
+
10716
+ open class ThreadSummary:
10717
+ ThreadSummaryProtocol {
10718
+ fileprivate let pointer: UnsafeMutableRawPointer!
10719
+
10720
+ /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
10721
+ public struct NoPointer {
10722
+ public init() {}
10723
+ }
10724
+
10725
+ // TODO: We'd like this to be `private` but for Swifty reasons,
10726
+ // we can't implement `FfiConverter` without making this `required` and we can't
10727
+ // make it `required` without making it `public`.
10728
+ required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
10729
+ self.pointer = pointer
10730
+ }
10731
+
10732
+ /// This constructor can be used to instantiate a fake object.
10733
+ /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
10734
+ ///
10735
+ /// - Warning:
10736
+ /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
10737
+ public init(noPointer: NoPointer) {
10738
+ self.pointer = nil
10739
+ }
10740
+
10741
+ public func uniffiClonePointer() -> UnsafeMutableRawPointer {
10742
+ return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_threadsummary(self.pointer, $0) }
10743
+ }
10744
+ // No primary constructor declared for this class.
10745
+
10746
+ deinit {
10747
+ guard let pointer = pointer else {
10748
+ return
10749
+ }
10750
+
10751
+ try! rustCall { uniffi_matrix_sdk_ffi_fn_free_threadsummary(pointer, $0) }
10752
+ }
10753
+
10754
+
10755
+
10756
+
10757
+ open func latestEvent() -> ThreadSummaryLatestEventDetails {
10758
+ return try! FfiConverterTypeThreadSummaryLatestEventDetails.lift(try! rustCall() {
10759
+ uniffi_matrix_sdk_ffi_fn_method_threadsummary_latest_event(self.uniffiClonePointer(),$0
10760
+ )
10761
+ })
10762
+ }
10763
+
10764
+
10765
+ }
10766
+
10767
+ public struct FfiConverterTypeThreadSummary: FfiConverter {
10768
+
10769
+ typealias FfiType = UnsafeMutableRawPointer
10770
+ typealias SwiftType = ThreadSummary
10771
+
10772
+ public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> ThreadSummary {
10773
+ return ThreadSummary(unsafeFromRawPointer: pointer)
10774
+ }
10775
+
10776
+ public static func lower(_ value: ThreadSummary) -> UnsafeMutableRawPointer {
10777
+ return value.uniffiClonePointer()
10778
+ }
10779
+
10780
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ThreadSummary {
10781
+ let v: UInt64 = try readInt(&buf)
10782
+ // The Rust code won't compile if a pointer won't fit in a UInt64.
10783
+ // We have to go via `UInt` because that's the thing that's the size of a pointer.
10784
+ let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
10785
+ if (ptr == nil) {
10786
+ throw UniffiInternalError.unexpectedNullPointer
10787
+ }
10788
+ return try lift(ptr!)
10789
+ }
10790
+
10791
+ public static func write(_ value: ThreadSummary, into buf: inout [UInt8]) {
10792
+ // This fiddling is because `Int` is the thing that's the same size as a pointer.
10793
+ // The Rust code won't compile if a pointer won't fit in a `UInt64`.
10794
+ writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
10795
+ }
10796
+ }
10797
+
10798
+
10799
+
10800
+
10801
+ public func FfiConverterTypeThreadSummary_lift(_ pointer: UnsafeMutableRawPointer) throws -> ThreadSummary {
10802
+ return try FfiConverterTypeThreadSummary.lift(pointer)
10803
+ }
10804
+
10805
+ public func FfiConverterTypeThreadSummary_lower(_ value: ThreadSummary) -> UnsafeMutableRawPointer {
10806
+ return FfiConverterTypeThreadSummary.lower(value)
10807
+ }
10808
+
10809
+
10810
+
10811
+
10710
10812
public protocol TimelineProtocol : AnyObject {
10711
10813
10712
10814
func addListener(listener: TimelineListener) async -> TaskHandle
@@ -14522,27 +14624,35 @@ public struct MsgLikeContent {
14522
14624
public var kind: MsgLikeKind
14523
14625
public var reactions: [Reaction]
14524
14626
/**
14525
- * Event ID of the thread root, if this is a threaded message.
14627
+ * The event this message is replying to, if any.
14628
+ */
14629
+ public var inReplyTo: InReplyToDetails?
14630
+ /**
14631
+ * Event ID of the thread root, if this is a message in a thread.
14526
14632
*/
14527
14633
public var threadRoot: String?
14528
14634
/**
14529
- * The event this message is replying to, if any .
14635
+ * Details about the thread this message is the root of .
14530
14636
*/
14531
- public var inReplyTo: InReplyToDetails ?
14637
+ public var threadSummary: ThreadSummary ?
14532
14638
14533
14639
// Default memberwise initializers are never public by default, so we
14534
14640
// declare one manually.
14535
14641
public init(kind: MsgLikeKind, reactions: [Reaction],
14536
14642
/**
14537
- * Event ID of the thread root, if this is a threaded message.
14643
+ * The event this message is replying to, if any.
14644
+ */inReplyTo: InReplyToDetails?,
14645
+ /**
14646
+ * Event ID of the thread root, if this is a message in a thread.
14538
14647
*/threadRoot: String?,
14539
14648
/**
14540
- * The event this message is replying to, if any .
14541
- */inReplyTo: InReplyToDetails ?) {
14649
+ * Details about the thread this message is the root of .
14650
+ */threadSummary: ThreadSummary ?) {
14542
14651
self.kind = kind
14543
14652
self.reactions = reactions
14544
- self.threadRoot = threadRoot
14545
14653
self.inReplyTo = inReplyTo
14654
+ self.threadRoot = threadRoot
14655
+ self.threadSummary = threadSummary
14546
14656
}
14547
14657
}
14548
14658
@@ -14554,16 +14664,18 @@ public struct FfiConverterTypeMsgLikeContent: FfiConverterRustBuffer {
14554
14664
try MsgLikeContent(
14555
14665
kind: FfiConverterTypeMsgLikeKind.read(from: &buf),
14556
14666
reactions: FfiConverterSequenceTypeReaction.read(from: &buf),
14667
+ inReplyTo: FfiConverterOptionTypeInReplyToDetails.read(from: &buf),
14557
14668
threadRoot: FfiConverterOptionString.read(from: &buf),
14558
- inReplyTo: FfiConverterOptionTypeInReplyToDetails .read(from: &buf)
14669
+ threadSummary: FfiConverterOptionTypeThreadSummary .read(from: &buf)
14559
14670
)
14560
14671
}
14561
14672
14562
14673
public static func write(_ value: MsgLikeContent, into buf: inout [UInt8]) {
14563
14674
FfiConverterTypeMsgLikeKind.write(value.kind, into: &buf)
14564
14675
FfiConverterSequenceTypeReaction.write(value.reactions, into: &buf)
14565
- FfiConverterOptionString.write(value.threadRoot, into: &buf)
14566
14676
FfiConverterOptionTypeInReplyToDetails.write(value.inReplyTo, into: &buf)
14677
+ FfiConverterOptionString.write(value.threadRoot, into: &buf)
14678
+ FfiConverterOptionTypeThreadSummary.write(value.threadSummary, into: &buf)
14567
14679
}
14568
14680
}
14569
14681
@@ -27171,7 +27283,8 @@ public enum StateEventContent {
27171
27283
case roomServerAcl
27172
27284
case roomThirdPartyInvite
27173
27285
case roomTombstone
27174
- case roomTopic
27286
+ case roomTopic(topic: String
27287
+ )
27175
27288
case spaceChild
27176
27289
case spaceParent
27177
27290
}
@@ -27221,7 +27334,8 @@ public struct FfiConverterTypeStateEventContent: FfiConverterRustBuffer {
27221
27334
27222
27335
case 18: return .roomTombstone
27223
27336
27224
- case 19: return .roomTopic
27337
+ case 19: return .roomTopic(topic: try FfiConverterString.read(from: &buf)
27338
+ )
27225
27339
27226
27340
case 20: return .spaceChild
27227
27341
@@ -27309,9 +27423,10 @@ public struct FfiConverterTypeStateEventContent: FfiConverterRustBuffer {
27309
27423
writeInt(&buf, Int32(18))
27310
27424
27311
27425
27312
- case .roomTopic:
27426
+ case let .roomTopic(topic) :
27313
27427
writeInt(&buf, Int32(19))
27314
-
27428
+ FfiConverterString.write(topic, into: &buf)
27429
+
27315
27430
27316
27431
case .spaceChild:
27317
27432
writeInt(&buf, Int32(20))
@@ -27678,6 +27793,80 @@ extension SyncServiceState: Equatable, Hashable {}
27678
27793
27679
27794
27680
27795
27796
+ // Note that we don't yet support `indirect` for enums.
27797
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
27798
+
27799
+ public enum ThreadSummaryLatestEventDetails {
27800
+
27801
+ case unavailable
27802
+ case pending
27803
+ case ready(sender: String, senderProfile: ProfileDetails, content: TimelineItemContent
27804
+ )
27805
+ case error(message: String
27806
+ )
27807
+ }
27808
+
27809
+
27810
+ public struct FfiConverterTypeThreadSummaryLatestEventDetails: FfiConverterRustBuffer {
27811
+ typealias SwiftType = ThreadSummaryLatestEventDetails
27812
+
27813
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ThreadSummaryLatestEventDetails {
27814
+ let variant: Int32 = try readInt(&buf)
27815
+ switch variant {
27816
+
27817
+ case 1: return .unavailable
27818
+
27819
+ case 2: return .pending
27820
+
27821
+ case 3: return .ready(sender: try FfiConverterString.read(from: &buf), senderProfile: try FfiConverterTypeProfileDetails.read(from: &buf), content: try FfiConverterTypeTimelineItemContent.read(from: &buf)
27822
+ )
27823
+
27824
+ case 4: return .error(message: try FfiConverterString.read(from: &buf)
27825
+ )
27826
+
27827
+ default: throw UniffiInternalError.unexpectedEnumCase
27828
+ }
27829
+ }
27830
+
27831
+ public static func write(_ value: ThreadSummaryLatestEventDetails, into buf: inout [UInt8]) {
27832
+ switch value {
27833
+
27834
+
27835
+ case .unavailable:
27836
+ writeInt(&buf, Int32(1))
27837
+
27838
+
27839
+ case .pending:
27840
+ writeInt(&buf, Int32(2))
27841
+
27842
+
27843
+ case let .ready(sender,senderProfile,content):
27844
+ writeInt(&buf, Int32(3))
27845
+ FfiConverterString.write(sender, into: &buf)
27846
+ FfiConverterTypeProfileDetails.write(senderProfile, into: &buf)
27847
+ FfiConverterTypeTimelineItemContent.write(content, into: &buf)
27848
+
27849
+
27850
+ case let .error(message):
27851
+ writeInt(&buf, Int32(4))
27852
+ FfiConverterString.write(message, into: &buf)
27853
+
27854
+ }
27855
+ }
27856
+ }
27857
+
27858
+
27859
+ public func FfiConverterTypeThreadSummaryLatestEventDetails_lift(_ buf: RustBuffer) throws -> ThreadSummaryLatestEventDetails {
27860
+ return try FfiConverterTypeThreadSummaryLatestEventDetails.lift(buf)
27861
+ }
27862
+
27863
+ public func FfiConverterTypeThreadSummaryLatestEventDetails_lower(_ value: ThreadSummaryLatestEventDetails) -> RustBuffer {
27864
+ return FfiConverterTypeThreadSummaryLatestEventDetails.lower(value)
27865
+ }
27866
+
27867
+
27868
+
27869
+
27681
27870
// Note that we don't yet support `indirect` for enums.
27682
27871
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
27683
27872
@@ -31358,6 +31547,27 @@ fileprivate struct FfiConverterOptionTypeTaskHandle: FfiConverterRustBuffer {
31358
31547
}
31359
31548
}
31360
31549
31550
+ fileprivate struct FfiConverterOptionTypeThreadSummary: FfiConverterRustBuffer {
31551
+ typealias SwiftType = ThreadSummary?
31552
+
31553
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
31554
+ guard let value = value else {
31555
+ writeInt(&buf, Int8(0))
31556
+ return
31557
+ }
31558
+ writeInt(&buf, Int8(1))
31559
+ FfiConverterTypeThreadSummary.write(value, into: &buf)
31560
+ }
31561
+
31562
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
31563
+ switch try readInt(&buf) as Int8 {
31564
+ case 0: return nil
31565
+ case 1: return try FfiConverterTypeThreadSummary.read(from: &buf)
31566
+ default: throw UniffiInternalError.unexpectedOptionalTag
31567
+ }
31568
+ }
31569
+ }
31570
+
31361
31571
fileprivate struct FfiConverterOptionTypeTimelineEventTypeFilter: FfiConverterRustBuffer {
31362
31572
typealias SwiftType = TimelineEventTypeFilter?
31363
31573
@@ -34734,6 +34944,9 @@ private var initializationResult: InitializationResult = {
34734
34944
if (uniffi_matrix_sdk_ffi_checksum_method_taskhandle_is_finished() != 29008) {
34735
34945
return InitializationResult.apiChecksumMismatch
34736
34946
}
34947
+ if (uniffi_matrix_sdk_ffi_checksum_method_threadsummary_latest_event() != 52190) {
34948
+ return InitializationResult.apiChecksumMismatch
34949
+ }
34737
34950
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_add_listener() != 18746) {
34738
34951
return InitializationResult.apiChecksumMismatch
34739
34952
}
0 commit comments