@@ -8934,9 +8934,7 @@ public protocol TimelineProtocol : AnyObject {
8934
8934
* Returns whether the edit did happen. It can only return false for
8935
8935
* local events that are being processed.
8936
8936
*/
8937
- func edit(item: EventTimelineItem, newContent: RoomMessageEventContentWithoutRelation) async throws -> Bool
8938
-
8939
- func editPoll(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind, editItem: EventTimelineItem) async throws
8937
+ func edit(item: EventTimelineItem, newContent: EditedContent) async throws -> Bool
8940
8938
8941
8939
func endPoll(pollStartId: String, text: String) throws
8942
8940
@@ -9167,13 +9165,13 @@ open func createPoll(question: String, answers: [String], maxSelections: UInt8,
9167
9165
* Returns whether the edit did happen. It can only return false for
9168
9166
* local events that are being processed.
9169
9167
*/
9170
- open func edit(item: EventTimelineItem, newContent: RoomMessageEventContentWithoutRelation )async throws -> Bool {
9168
+ open func edit(item: EventTimelineItem, newContent: EditedContent )async throws -> Bool {
9171
9169
return
9172
9170
try await uniffiRustCallAsync(
9173
9171
rustFutureFunc: {
9174
9172
uniffi_matrix_sdk_ffi_fn_method_timeline_edit(
9175
9173
self.uniffiClonePointer(),
9176
- FfiConverterTypeEventTimelineItem.lower(item),FfiConverterTypeRoomMessageEventContentWithoutRelation .lower(newContent)
9174
+ FfiConverterTypeEventTimelineItem.lower(item),FfiConverterTypeEditedContent .lower(newContent)
9177
9175
)
9178
9176
},
9179
9177
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
@@ -9184,23 +9182,6 @@ open func edit(item: EventTimelineItem, newContent: RoomMessageEventContentWitho
9184
9182
)
9185
9183
}
9186
9184
9187
- open func editPoll(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind, editItem: EventTimelineItem)async throws {
9188
- return
9189
- try await uniffiRustCallAsync(
9190
- rustFutureFunc: {
9191
- uniffi_matrix_sdk_ffi_fn_method_timeline_edit_poll(
9192
- self.uniffiClonePointer(),
9193
- FfiConverterString.lower(question),FfiConverterSequenceString.lower(answers),FfiConverterUInt8.lower(maxSelections),FfiConverterTypePollKind.lower(pollKind),FfiConverterTypeEventTimelineItem.lower(editItem)
9194
- )
9195
- },
9196
- pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
9197
- completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
9198
- freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
9199
- liftFunc: { $0 },
9200
- errorHandler: FfiConverterTypeClientError.lift
9201
- )
9202
- }
9203
-
9204
9185
open func endPoll(pollStartId: String, text: String)throws {try rustCallWithError(FfiConverterTypeClientError.lift) {
9205
9186
uniffi_matrix_sdk_ffi_fn_method_timeline_end_poll(self.uniffiClonePointer(),
9206
9187
FfiConverterString.lower(pollStartId),
@@ -12705,6 +12686,79 @@ public func FfiConverterTypePollAnswer_lower(_ value: PollAnswer) -> RustBuffer
12705
12686
}
12706
12687
12707
12688
12689
+ public struct PollData {
12690
+ public var question: String
12691
+ public var answers: [String]
12692
+ public var maxSelections: UInt8
12693
+ public var pollKind: PollKind
12694
+
12695
+ // Default memberwise initializers are never public by default, so we
12696
+ // declare one manually.
12697
+ public init(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind) {
12698
+ self.question = question
12699
+ self.answers = answers
12700
+ self.maxSelections = maxSelections
12701
+ self.pollKind = pollKind
12702
+ }
12703
+ }
12704
+
12705
+
12706
+
12707
+ extension PollData: Equatable, Hashable {
12708
+ public static func ==(lhs: PollData, rhs: PollData) -> Bool {
12709
+ if lhs.question != rhs.question {
12710
+ return false
12711
+ }
12712
+ if lhs.answers != rhs.answers {
12713
+ return false
12714
+ }
12715
+ if lhs.maxSelections != rhs.maxSelections {
12716
+ return false
12717
+ }
12718
+ if lhs.pollKind != rhs.pollKind {
12719
+ return false
12720
+ }
12721
+ return true
12722
+ }
12723
+
12724
+ public func hash(into hasher: inout Hasher) {
12725
+ hasher.combine(question)
12726
+ hasher.combine(answers)
12727
+ hasher.combine(maxSelections)
12728
+ hasher.combine(pollKind)
12729
+ }
12730
+ }
12731
+
12732
+
12733
+ public struct FfiConverterTypePollData: FfiConverterRustBuffer {
12734
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PollData {
12735
+ return
12736
+ try PollData(
12737
+ question: FfiConverterString.read(from: &buf),
12738
+ answers: FfiConverterSequenceString.read(from: &buf),
12739
+ maxSelections: FfiConverterUInt8.read(from: &buf),
12740
+ pollKind: FfiConverterTypePollKind.read(from: &buf)
12741
+ )
12742
+ }
12743
+
12744
+ public static func write(_ value: PollData, into buf: inout [UInt8]) {
12745
+ FfiConverterString.write(value.question, into: &buf)
12746
+ FfiConverterSequenceString.write(value.answers, into: &buf)
12747
+ FfiConverterUInt8.write(value.maxSelections, into: &buf)
12748
+ FfiConverterTypePollKind.write(value.pollKind, into: &buf)
12749
+ }
12750
+ }
12751
+
12752
+
12753
+ public func FfiConverterTypePollData_lift(_ buf: RustBuffer) throws -> PollData {
12754
+ return try FfiConverterTypePollData.lift(buf)
12755
+ }
12756
+
12757
+ public func FfiConverterTypePollData_lower(_ value: PollData) -> RustBuffer {
12758
+ return FfiConverterTypePollData.lower(value)
12759
+ }
12760
+
12761
+
12708
12762
public struct PowerLevels {
12709
12763
public var usersDefault: Int32?
12710
12764
public var eventsDefault: Int32?
@@ -16790,6 +16844,64 @@ extension CrossSigningResetAuthType: Equatable, Hashable {}
16790
16844
16791
16845
16792
16846
16847
+ // Note that we don't yet support `indirect` for enums.
16848
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
16849
+
16850
+ public enum EditedContent {
16851
+
16852
+ case roomMessage(content: RoomMessageEventContentWithoutRelation
16853
+ )
16854
+ case pollStart(pollData: PollData
16855
+ )
16856
+ }
16857
+
16858
+
16859
+ public struct FfiConverterTypeEditedContent: FfiConverterRustBuffer {
16860
+ typealias SwiftType = EditedContent
16861
+
16862
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EditedContent {
16863
+ let variant: Int32 = try readInt(&buf)
16864
+ switch variant {
16865
+
16866
+ case 1: return .roomMessage(content: try FfiConverterTypeRoomMessageEventContentWithoutRelation.read(from: &buf)
16867
+ )
16868
+
16869
+ case 2: return .pollStart(pollData: try FfiConverterTypePollData.read(from: &buf)
16870
+ )
16871
+
16872
+ default: throw UniffiInternalError.unexpectedEnumCase
16873
+ }
16874
+ }
16875
+
16876
+ public static func write(_ value: EditedContent, into buf: inout [UInt8]) {
16877
+ switch value {
16878
+
16879
+
16880
+ case let .roomMessage(content):
16881
+ writeInt(&buf, Int32(1))
16882
+ FfiConverterTypeRoomMessageEventContentWithoutRelation.write(content, into: &buf)
16883
+
16884
+
16885
+ case let .pollStart(pollData):
16886
+ writeInt(&buf, Int32(2))
16887
+ FfiConverterTypePollData.write(pollData, into: &buf)
16888
+
16889
+ }
16890
+ }
16891
+ }
16892
+
16893
+
16894
+ public func FfiConverterTypeEditedContent_lift(_ buf: RustBuffer) throws -> EditedContent {
16895
+ return try FfiConverterTypeEditedContent.lift(buf)
16896
+ }
16897
+
16898
+ public func FfiConverterTypeEditedContent_lower(_ value: EditedContent) -> RustBuffer {
16899
+ return FfiConverterTypeEditedContent.lower(value)
16900
+ }
16901
+
16902
+
16903
+
16904
+
16793
16905
// Note that we don't yet support `indirect` for enums.
16794
16906
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
16795
16907
@@ -27868,10 +27980,7 @@ private var initializationResult: InitializationResult = {
27868
27980
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_create_poll() != 37925) {
27869
27981
return InitializationResult.apiChecksumMismatch
27870
27982
}
27871
- if (uniffi_matrix_sdk_ffi_checksum_method_timeline_edit() != 9304) {
27872
- return InitializationResult.apiChecksumMismatch
27873
- }
27874
- if (uniffi_matrix_sdk_ffi_checksum_method_timeline_edit_poll() != 40066) {
27983
+ if (uniffi_matrix_sdk_ffi_checksum_method_timeline_edit() != 14692) {
27875
27984
return InitializationResult.apiChecksumMismatch
27876
27985
}
27877
27986
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_end_poll() != 31506) {
0 commit comments