@@ -15827,6 +15827,136 @@ public func FfiConverterTypeTimelineEvent_lower(_ value: TimelineEvent) -> UInt6
1582715827
1582815828
1582915829
15830+ /**
15831+ * A timeline filter that includes or excludes events based on their type or
15832+ * content.
15833+ */
15834+ public protocol TimelineEventFilterProtocol: AnyObject, Sendable {
15835+
15836+ }
15837+ /**
15838+ * A timeline filter that includes or excludes events based on their type or
15839+ * content.
15840+ */
15841+ open class TimelineEventFilter: TimelineEventFilterProtocol, @unchecked Sendable {
15842+ fileprivate let handle: UInt64
15843+
15844+ /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly.
15845+ #if swift(>=5.8)
15846+ @_documentation(visibility: private)
15847+ #endif
15848+ public struct NoHandle {
15849+ public init() {}
15850+ }
15851+
15852+ // TODO: We'd like this to be `private` but for Swifty reasons,
15853+ // we can't implement `FfiConverter` without making this `required` and we can't
15854+ // make it `required` without making it `public`.
15855+ #if swift(>=5.8)
15856+ @_documentation(visibility: private)
15857+ #endif
15858+ required public init(unsafeFromHandle handle: UInt64) {
15859+ self.handle = handle
15860+ }
15861+
15862+ // This constructor can be used to instantiate a fake object.
15863+ // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
15864+ //
15865+ // - Warning:
15866+ // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash.
15867+ #if swift(>=5.8)
15868+ @_documentation(visibility: private)
15869+ #endif
15870+ public init(noHandle: NoHandle) {
15871+ self.handle = 0
15872+ }
15873+
15874+ #if swift(>=5.8)
15875+ @_documentation(visibility: private)
15876+ #endif
15877+ public func uniffiCloneHandle() -> UInt64 {
15878+ return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_timelineeventfilter(self.handle, $0) }
15879+ }
15880+ // No primary constructor declared for this class.
15881+
15882+ deinit {
15883+ if handle == 0 {
15884+ // Mock objects have handle=0 don't try to free them
15885+ return
15886+ }
15887+
15888+ try! rustCall { uniffi_matrix_sdk_ffi_fn_free_timelineeventfilter(handle, $0) }
15889+ }
15890+
15891+
15892+ public static func exclude(conditions: [FilterTimelineEventCondition]) -> TimelineEventFilter {
15893+ return try! FfiConverterTypeTimelineEventFilter_lift(try! rustCall() {
15894+ uniffi_matrix_sdk_ffi_fn_constructor_timelineeventfilter_exclude(
15895+ FfiConverterSequenceTypeFilterTimelineEventCondition.lower(conditions),$0
15896+ )
15897+ })
15898+ }
15899+
15900+ public static func include(conditions: [FilterTimelineEventCondition]) -> TimelineEventFilter {
15901+ return try! FfiConverterTypeTimelineEventFilter_lift(try! rustCall() {
15902+ uniffi_matrix_sdk_ffi_fn_constructor_timelineeventfilter_include(
15903+ FfiConverterSequenceTypeFilterTimelineEventCondition.lower(conditions),$0
15904+ )
15905+ })
15906+ }
15907+
15908+
15909+
15910+
15911+
15912+ }
15913+
15914+
15915+ #if swift(>=5.8)
15916+ @_documentation(visibility: private)
15917+ #endif
15918+ public struct FfiConverterTypeTimelineEventFilter: FfiConverter {
15919+ typealias FfiType = UInt64
15920+ typealias SwiftType = TimelineEventFilter
15921+
15922+ public static func lift(_ handle: UInt64) throws -> TimelineEventFilter {
15923+ return TimelineEventFilter(unsafeFromHandle: handle)
15924+ }
15925+
15926+ public static func lower(_ value: TimelineEventFilter) -> UInt64 {
15927+ return value.uniffiCloneHandle()
15928+ }
15929+
15930+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimelineEventFilter {
15931+ let handle: UInt64 = try readInt(&buf)
15932+ return try lift(handle)
15933+ }
15934+
15935+ public static func write(_ value: TimelineEventFilter, into buf: inout [UInt8]) {
15936+ writeInt(&buf, lower(value))
15937+ }
15938+ }
15939+
15940+
15941+ #if swift(>=5.8)
15942+ @_documentation(visibility: private)
15943+ #endif
15944+ public func FfiConverterTypeTimelineEventFilter_lift(_ handle: UInt64) throws -> TimelineEventFilter {
15945+ return try FfiConverterTypeTimelineEventFilter.lift(handle)
15946+ }
15947+
15948+ #if swift(>=5.8)
15949+ @_documentation(visibility: private)
15950+ #endif
15951+ public func FfiConverterTypeTimelineEventFilter_lower(_ value: TimelineEventFilter) -> UInt64 {
15952+ return FfiConverterTypeTimelineEventFilter.lower(value)
15953+ }
15954+
15955+
15956+
15957+
15958+
15959+
1583015960public protocol TimelineEventTypeFilterProtocol: AnyObject, Sendable {
1583115961
1583215962}
@@ -27474,6 +27604,97 @@ public func FfiConverterTypeEventSendState_lower(_ value: EventSendState) -> Rus
2747427604}
2747527605
2747627606
27607+ // Note that we don't yet support `indirect` for enums.
27608+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
27609+ /**
27610+ * A condition that matches on an event's type or content.
27611+ */
27612+
27613+ public enum FilterTimelineEventCondition: Equatable, Hashable {
27614+
27615+ /**
27616+ * The event has the specified event type.
27617+ */
27618+ case eventType(eventType: FilterTimelineEventType
27619+ )
27620+ /**
27621+ * The event is an `m.room.member` event that represents a membership
27622+ * change (join, leave, etc.).
27623+ */
27624+ case membershipChange
27625+ /**
27626+ * The event is an `m.room.member` event that represents a profile
27627+ * change (displayname or avatar URL).
27628+ */
27629+ case profileChange
27630+
27631+
27632+
27633+
27634+
27635+ }
27636+
27637+ #if compiler(>=6)
27638+ extension FilterTimelineEventCondition: Sendable {}
27639+ #endif
27640+
27641+ #if swift(>=5.8)
27642+ @_documentation(visibility: private)
27643+ #endif
27644+ public struct FfiConverterTypeFilterTimelineEventCondition: FfiConverterRustBuffer {
27645+ typealias SwiftType = FilterTimelineEventCondition
27646+
27647+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FilterTimelineEventCondition {
27648+ let variant: Int32 = try readInt(&buf)
27649+ switch variant {
27650+
27651+ case 1: return .eventType(eventType: try FfiConverterTypeFilterTimelineEventType.read(from: &buf)
27652+ )
27653+
27654+ case 2: return .membershipChange
27655+
27656+ case 3: return .profileChange
27657+
27658+ default: throw UniffiInternalError.unexpectedEnumCase
27659+ }
27660+ }
27661+
27662+ public static func write(_ value: FilterTimelineEventCondition, into buf: inout [UInt8]) {
27663+ switch value {
27664+
27665+
27666+ case let .eventType(eventType):
27667+ writeInt(&buf, Int32(1))
27668+ FfiConverterTypeFilterTimelineEventType.write(eventType, into: &buf)
27669+
27670+
27671+ case .membershipChange:
27672+ writeInt(&buf, Int32(2))
27673+
27674+
27675+ case .profileChange:
27676+ writeInt(&buf, Int32(3))
27677+
27678+ }
27679+ }
27680+ }
27681+
27682+
27683+ #if swift(>=5.8)
27684+ @_documentation(visibility: private)
27685+ #endif
27686+ public func FfiConverterTypeFilterTimelineEventCondition_lift(_ buf: RustBuffer) throws -> FilterTimelineEventCondition {
27687+ return try FfiConverterTypeFilterTimelineEventCondition.lift(buf)
27688+ }
27689+
27690+ #if swift(>=5.8)
27691+ @_documentation(visibility: private)
27692+ #endif
27693+ public func FfiConverterTypeFilterTimelineEventCondition_lower(_ value: FilterTimelineEventCondition) -> RustBuffer {
27694+ return FfiConverterTypeFilterTimelineEventCondition.lower(value)
27695+ }
27696+
27697+
2747727698// Note that we don't yet support `indirect` for enums.
2747827699// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2747927700
@@ -37259,6 +37480,11 @@ public enum TimelineFilter {
3725937480 */
3726037481 case eventTypeFilter(filter: TimelineEventTypeFilter
3726137482 )
37483+ /**
37484+ * Show only events which match this event filter.
37485+ */
37486+ case eventFilter(filter: TimelineEventFilter
37487+ )
3726237488
3726337489
3726437490
@@ -37288,6 +37514,9 @@ public struct FfiConverterTypeTimelineFilter: FfiConverterRustBuffer {
3728837514 case 3: return .eventTypeFilter(filter: try FfiConverterTypeTimelineEventTypeFilter.read(from: &buf)
3728937515 )
3729037516
37517+ case 4: return .eventFilter(filter: try FfiConverterTypeTimelineEventFilter.read(from: &buf)
37518+ )
37519+
3729137520 default: throw UniffiInternalError.unexpectedEnumCase
3729237521 }
3729337522 }
@@ -37309,6 +37538,11 @@ public struct FfiConverterTypeTimelineFilter: FfiConverterRustBuffer {
3730937538 writeInt(&buf, Int32(3))
3731037539 FfiConverterTypeTimelineEventTypeFilter.write(filter, into: &buf)
3731137540
37541+
37542+ case let .eventFilter(filter):
37543+ writeInt(&buf, Int32(4))
37544+ FfiConverterTypeTimelineEventFilter.write(filter, into: &buf)
37545+
3731237546 }
3731337547 }
3731437548}
@@ -46321,6 +46555,31 @@ fileprivate struct FfiConverterSequenceTypeDraftAttachment: FfiConverterRustBuff
4632146555 }
4632246556}
4632346557
46558+ #if swift(>=5.8)
46559+ @_documentation(visibility: private)
46560+ #endif
46561+ fileprivate struct FfiConverterSequenceTypeFilterTimelineEventCondition: FfiConverterRustBuffer {
46562+ typealias SwiftType = [FilterTimelineEventCondition]
46563+
46564+ public static func write(_ value: [FilterTimelineEventCondition], into buf: inout [UInt8]) {
46565+ let len = Int32(value.count)
46566+ writeInt(&buf, len)
46567+ for item in value {
46568+ FfiConverterTypeFilterTimelineEventCondition.write(item, into: &buf)
46569+ }
46570+ }
46571+
46572+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [FilterTimelineEventCondition] {
46573+ let len: Int32 = try readInt(&buf)
46574+ var seq = [FilterTimelineEventCondition]()
46575+ seq.reserveCapacity(Int(len))
46576+ for _ in 0 ..< len {
46577+ seq.append(try FfiConverterTypeFilterTimelineEventCondition.read(from: &buf))
46578+ }
46579+ return seq
46580+ }
46581+ }
46582+
4632446583#if swift(>=5.8)
4632546584@_documentation(visibility: private)
4632646585#endif
@@ -48816,6 +49075,12 @@ private let initializationResult: InitializationResult = {
4881649075 if (uniffi_matrix_sdk_ffi_checksum_constructor_sqlitestorebuilder_new() != 604) {
4881749076 return InitializationResult.apiChecksumMismatch
4881849077 }
49078+ if (uniffi_matrix_sdk_ffi_checksum_constructor_timelineeventfilter_exclude() != 53140) {
49079+ return InitializationResult.apiChecksumMismatch
49080+ }
49081+ if (uniffi_matrix_sdk_ffi_checksum_constructor_timelineeventfilter_include() != 40738) {
49082+ return InitializationResult.apiChecksumMismatch
49083+ }
4881949084 if (uniffi_matrix_sdk_ffi_checksum_constructor_timelineeventtypefilter_exclude() != 17142) {
4882049085 return InitializationResult.apiChecksumMismatch
4882149086 }
0 commit comments