@@ -395,6 +395,27 @@ fileprivate struct FfiConverterInt64: FfiConverterPrimitive {
395395 }
396396}
397397
398+ fileprivate struct FfiConverterBool : FfiConverter {
399+ typealias FfiType = Int8
400+ typealias SwiftType = Bool
401+
402+ public static func lift( _ value: Int8 ) throws -> Bool {
403+ return value != 0
404+ }
405+
406+ public static func lower( _ value: Bool ) -> Int8 {
407+ return value ? 1 : 0
408+ }
409+
410+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> Bool {
411+ return try lift ( readInt ( & buf) )
412+ }
413+
414+ public static func write( _ value: Bool , into buf: inout [ UInt8 ] ) {
415+ writeInt ( & buf, lower ( value) )
416+ }
417+ }
418+
398419fileprivate struct FfiConverterString : FfiConverter {
399420 typealias SwiftType = String
400421 typealias FfiType = RustBuffer
@@ -437,9 +458,9 @@ fileprivate struct FfiConverterString: FfiConverter {
437458
438459
439460/**
440- * The data needed to perform authorization using OpenID Connect .
461+ * The data needed to perform authorization using OAuth 2.0 .
441462 */
442- public protocol OidcAuthorizationDataProtocol : AnyObject {
463+ public protocol OAuthAuthorizationDataProtocol : AnyObject {
443464
444465 /**
445466 * The login URL to use for authorization.
@@ -449,10 +470,10 @@ public protocol OidcAuthorizationDataProtocol : AnyObject {
449470}
450471
451472/**
452- * The data needed to perform authorization using OpenID Connect .
473+ * The data needed to perform authorization using OAuth 2.0 .
453474 */
454- open class OidcAuthorizationData :
455- OidcAuthorizationDataProtocol {
475+ open class OAuthAuthorizationData :
476+ OAuthAuthorizationDataProtocol {
456477 fileprivate let pointer : UnsafeMutableRawPointer !
457478
458479 /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
@@ -477,7 +498,7 @@ open class OidcAuthorizationData:
477498 }
478499
479500 public func uniffiClonePointer( ) -> UnsafeMutableRawPointer {
480- return try ! rustCall { uniffi_matrix_sdk_fn_clone_oidcauthorizationdata ( self . pointer, $0) }
501+ return try ! rustCall { uniffi_matrix_sdk_fn_clone_oauthauthorizationdata ( self . pointer, $0) }
481502 }
482503 // No primary constructor declared for this class.
483504
@@ -486,7 +507,7 @@ open class OidcAuthorizationData:
486507 return
487508 }
488509
489- try ! rustCall { uniffi_matrix_sdk_fn_free_oidcauthorizationdata ( pointer, $0) }
510+ try ! rustCall { uniffi_matrix_sdk_fn_free_oauthauthorizationdata ( pointer, $0) }
490511 }
491512
492513
@@ -497,28 +518,28 @@ open class OidcAuthorizationData:
497518 */
498519open func loginUrl( ) -> String {
499520 return try ! FfiConverterString . lift ( try ! rustCall ( ) {
500- uniffi_matrix_sdk_fn_method_oidcauthorizationdata_login_url ( self . uniffiClonePointer ( ) , $0
521+ uniffi_matrix_sdk_fn_method_oauthauthorizationdata_login_url ( self . uniffiClonePointer ( ) , $0
501522 )
502523} )
503524}
504525
505526
506527}
507528
508- public struct FfiConverterTypeOidcAuthorizationData : FfiConverter {
529+ public struct FfiConverterTypeOAuthAuthorizationData : FfiConverter {
509530
510531 typealias FfiType = UnsafeMutableRawPointer
511- typealias SwiftType = OidcAuthorizationData
532+ typealias SwiftType = OAuthAuthorizationData
512533
513- public static func lift( _ pointer: UnsafeMutableRawPointer ) throws -> OidcAuthorizationData {
514- return OidcAuthorizationData ( unsafeFromRawPointer: pointer)
534+ public static func lift( _ pointer: UnsafeMutableRawPointer ) throws -> OAuthAuthorizationData {
535+ return OAuthAuthorizationData ( unsafeFromRawPointer: pointer)
515536 }
516537
517- public static func lower( _ value: OidcAuthorizationData ) -> UnsafeMutableRawPointer {
538+ public static func lower( _ value: OAuthAuthorizationData ) -> UnsafeMutableRawPointer {
518539 return value. uniffiClonePointer ( )
519540 }
520541
521- public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> OidcAuthorizationData {
542+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> OAuthAuthorizationData {
522543 let v : UInt64 = try readInt ( & buf)
523544 // The Rust code won't compile if a pointer won't fit in a UInt64.
524545 // We have to go via `UInt` because that's the thing that's the size of a pointer.
@@ -529,7 +550,7 @@ public struct FfiConverterTypeOidcAuthorizationData: FfiConverter {
529550 return try lift ( ptr!)
530551 }
531552
532- public static func write( _ value: OidcAuthorizationData , into buf: inout [ UInt8 ] ) {
553+ public static func write( _ value: OAuthAuthorizationData , into buf: inout [ UInt8 ] ) {
533554 // This fiddling is because `Int` is the thing that's the same size as a pointer.
534555 // The Rust code won't compile if a pointer won't fit in a `UInt64`.
535556 writeInt ( & buf, UInt64 ( bitPattern: Int64 ( Int ( bitPattern: lower ( value) ) ) ) )
@@ -539,12 +560,12 @@ public struct FfiConverterTypeOidcAuthorizationData: FfiConverter {
539560
540561
541562
542- public func FfiConverterTypeOidcAuthorizationData_lift ( _ pointer: UnsafeMutableRawPointer ) throws -> OidcAuthorizationData {
543- return try FfiConverterTypeOidcAuthorizationData . lift ( pointer)
563+ public func FfiConverterTypeOAuthAuthorizationData_lift ( _ pointer: UnsafeMutableRawPointer ) throws -> OAuthAuthorizationData {
564+ return try FfiConverterTypeOAuthAuthorizationData . lift ( pointer)
544565}
545566
546- public func FfiConverterTypeOidcAuthorizationData_lower ( _ value: OidcAuthorizationData ) -> UnsafeMutableRawPointer {
547- return FfiConverterTypeOidcAuthorizationData . lower ( value)
567+ public func FfiConverterTypeOAuthAuthorizationData_lower ( _ value: OAuthAuthorizationData ) -> UnsafeMutableRawPointer {
568+ return FfiConverterTypeOAuthAuthorizationData . lower ( value)
548569}
549570
550571
@@ -917,7 +938,7 @@ public enum QrCodeLoginError {
917938 * An error happened while we were communicating with the OAuth 2.0
918939 * authorization server.
919940 */
920- case Oauth ( message: String )
941+ case OAuth ( message: String )
921942
922943 /**
923944 * The other device has signaled to us that the login has failed.
@@ -976,7 +997,7 @@ public struct FfiConverterTypeQRCodeLoginError: FfiConverterRustBuffer {
976997
977998
978999
979- case 1 : return . Oauth (
1000+ case 1 : return . OAuth (
9801001 message: try FfiConverterString . read ( from: & buf)
9811002 )
9821003
@@ -1023,7 +1044,7 @@ public struct FfiConverterTypeQRCodeLoginError: FfiConverterRustBuffer {
10231044
10241045
10251046
1026- case . Oauth ( _ /* message is ignored*/) :
1047+ case . OAuth ( _ /* message is ignored*/) :
10271048 writeInt ( & buf, Int32 ( 1 ) )
10281049 case . LoginFailure( _ /* message is ignored*/) :
10291050 writeInt ( & buf, Int32 ( 2 ) )
@@ -1130,6 +1151,77 @@ extension RoomMemberRole: Equatable, Hashable {}
11301151
11311152
11321153
1154+ // Note that we don't yet support `indirect` for enums.
1155+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
1156+ /**
1157+ * Status for the back-pagination on a room event cache.
1158+ */
1159+
1160+ public enum RoomPaginationStatus {
1161+
1162+ /**
1163+ * No back-pagination is happening right now.
1164+ */
1165+ case idle(
1166+ /**
1167+ * Have we hit the start of the timeline, i.e. back-paginating wouldn't
1168+ * have any effect?
1169+ */hitTimelineStart: Bool
1170+ )
1171+ /**
1172+ * Back-pagination is already running in the background.
1173+ */
1174+ case paginating
1175+ }
1176+
1177+
1178+ public struct FfiConverterTypeRoomPaginationStatus : FfiConverterRustBuffer {
1179+ typealias SwiftType = RoomPaginationStatus
1180+
1181+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> RoomPaginationStatus {
1182+ let variant : Int32 = try readInt ( & buf)
1183+ switch variant {
1184+
1185+ case 1 : return . idle( hitTimelineStart: try FfiConverterBool . read ( from: & buf)
1186+ )
1187+
1188+ case 2 : return . paginating
1189+
1190+ default : throw UniffiInternalError . unexpectedEnumCase
1191+ }
1192+ }
1193+
1194+ public static func write( _ value: RoomPaginationStatus , into buf: inout [ UInt8 ] ) {
1195+ switch value {
1196+
1197+
1198+ case let . idle( hitTimelineStart) :
1199+ writeInt ( & buf, Int32 ( 1 ) )
1200+ FfiConverterBool . write ( hitTimelineStart, into: & buf)
1201+
1202+
1203+ case . paginating:
1204+ writeInt ( & buf, Int32 ( 2 ) )
1205+
1206+ }
1207+ }
1208+ }
1209+
1210+
1211+ public func FfiConverterTypeRoomPaginationStatus_lift( _ buf: RustBuffer ) throws -> RoomPaginationStatus {
1212+ return try FfiConverterTypeRoomPaginationStatus . lift ( buf)
1213+ }
1214+
1215+ public func FfiConverterTypeRoomPaginationStatus_lower( _ value: RoomPaginationStatus ) -> RustBuffer {
1216+ return FfiConverterTypeRoomPaginationStatus . lower ( value)
1217+ }
1218+
1219+
1220+
1221+ extension RoomPaginationStatus : Equatable , Hashable { }
1222+
1223+
1224+
11331225fileprivate struct FfiConverterOptionInt64 : FfiConverterRustBuffer {
11341226 typealias SwiftType = Int64 ?
11351227
@@ -1166,7 +1258,7 @@ private var initializationResult: InitializationResult = {
11661258 if bindings_contract_version != scaffolding_contract_version {
11671259 return InitializationResult . contractVersionMismatch
11681260 }
1169- if ( uniffi_matrix_sdk_checksum_method_oidcauthorizationdata_login_url ( ) != 59213 ) {
1261+ if ( uniffi_matrix_sdk_checksum_method_oauthauthorizationdata_login_url ( ) != 25566 ) {
11701262 return InitializationResult . apiChecksumMismatch
11711263 }
11721264
0 commit comments