@@ -395,6 +395,27 @@ fileprivate struct FfiConverterInt64: FfiConverterPrimitive {
395
395
}
396
396
}
397
397
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
+
398
419
fileprivate struct FfiConverterString : FfiConverter {
399
420
typealias SwiftType = String
400
421
typealias FfiType = RustBuffer
@@ -437,9 +458,9 @@ fileprivate struct FfiConverterString: FfiConverter {
437
458
438
459
439
460
/**
440
- * The data needed to perform authorization using OpenID Connect .
461
+ * The data needed to perform authorization using OAuth 2.0 .
441
462
*/
442
- public protocol OidcAuthorizationDataProtocol : AnyObject {
463
+ public protocol OAuthAuthorizationDataProtocol : AnyObject {
443
464
444
465
/**
445
466
* The login URL to use for authorization.
@@ -449,10 +470,10 @@ public protocol OidcAuthorizationDataProtocol : AnyObject {
449
470
}
450
471
451
472
/**
452
- * The data needed to perform authorization using OpenID Connect .
473
+ * The data needed to perform authorization using OAuth 2.0 .
453
474
*/
454
- open class OidcAuthorizationData :
455
- OidcAuthorizationDataProtocol {
475
+ open class OAuthAuthorizationData :
476
+ OAuthAuthorizationDataProtocol {
456
477
fileprivate let pointer : UnsafeMutableRawPointer !
457
478
458
479
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
@@ -477,7 +498,7 @@ open class OidcAuthorizationData:
477
498
}
478
499
479
500
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) }
481
502
}
482
503
// No primary constructor declared for this class.
483
504
@@ -486,7 +507,7 @@ open class OidcAuthorizationData:
486
507
return
487
508
}
488
509
489
- try ! rustCall { uniffi_matrix_sdk_fn_free_oidcauthorizationdata ( pointer, $0) }
510
+ try ! rustCall { uniffi_matrix_sdk_fn_free_oauthauthorizationdata ( pointer, $0) }
490
511
}
491
512
492
513
@@ -497,28 +518,28 @@ open class OidcAuthorizationData:
497
518
*/
498
519
open func loginUrl( ) -> String {
499
520
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
501
522
)
502
523
} )
503
524
}
504
525
505
526
506
527
}
507
528
508
- public struct FfiConverterTypeOidcAuthorizationData : FfiConverter {
529
+ public struct FfiConverterTypeOAuthAuthorizationData : FfiConverter {
509
530
510
531
typealias FfiType = UnsafeMutableRawPointer
511
- typealias SwiftType = OidcAuthorizationData
532
+ typealias SwiftType = OAuthAuthorizationData
512
533
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)
515
536
}
516
537
517
- public static func lower( _ value: OidcAuthorizationData ) -> UnsafeMutableRawPointer {
538
+ public static func lower( _ value: OAuthAuthorizationData ) -> UnsafeMutableRawPointer {
518
539
return value. uniffiClonePointer ( )
519
540
}
520
541
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 {
522
543
let v : UInt64 = try readInt ( & buf)
523
544
// The Rust code won't compile if a pointer won't fit in a UInt64.
524
545
// 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 {
529
550
return try lift ( ptr!)
530
551
}
531
552
532
- public static func write( _ value: OidcAuthorizationData , into buf: inout [ UInt8 ] ) {
553
+ public static func write( _ value: OAuthAuthorizationData , into buf: inout [ UInt8 ] ) {
533
554
// This fiddling is because `Int` is the thing that's the same size as a pointer.
534
555
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
535
556
writeInt ( & buf, UInt64 ( bitPattern: Int64 ( Int ( bitPattern: lower ( value) ) ) ) )
@@ -539,12 +560,12 @@ public struct FfiConverterTypeOidcAuthorizationData: FfiConverter {
539
560
540
561
541
562
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)
544
565
}
545
566
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)
548
569
}
549
570
550
571
@@ -917,7 +938,7 @@ public enum QrCodeLoginError {
917
938
* An error happened while we were communicating with the OAuth 2.0
918
939
* authorization server.
919
940
*/
920
- case Oauth ( message: String )
941
+ case OAuth ( message: String )
921
942
922
943
/**
923
944
* The other device has signaled to us that the login has failed.
@@ -976,7 +997,7 @@ public struct FfiConverterTypeQRCodeLoginError: FfiConverterRustBuffer {
976
997
977
998
978
999
979
- case 1 : return . Oauth (
1000
+ case 1 : return . OAuth (
980
1001
message: try FfiConverterString . read ( from: & buf)
981
1002
)
982
1003
@@ -1023,7 +1044,7 @@ public struct FfiConverterTypeQRCodeLoginError: FfiConverterRustBuffer {
1023
1044
1024
1045
1025
1046
1026
- case . Oauth ( _ /* message is ignored*/) :
1047
+ case . OAuth ( _ /* message is ignored*/) :
1027
1048
writeInt ( & buf, Int32 ( 1 ) )
1028
1049
case . LoginFailure( _ /* message is ignored*/) :
1029
1050
writeInt ( & buf, Int32 ( 2 ) )
@@ -1130,6 +1151,77 @@ extension RoomMemberRole: Equatable, Hashable {}
1130
1151
1131
1152
1132
1153
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
+
1133
1225
fileprivate struct FfiConverterOptionInt64 : FfiConverterRustBuffer {
1134
1226
typealias SwiftType = Int64 ?
1135
1227
@@ -1166,7 +1258,7 @@ private var initializationResult: InitializationResult = {
1166
1258
if bindings_contract_version != scaffolding_contract_version {
1167
1259
return InitializationResult . contractVersionMismatch
1168
1260
}
1169
- if ( uniffi_matrix_sdk_checksum_method_oidcauthorizationdata_login_url ( ) != 59213 ) {
1261
+ if ( uniffi_matrix_sdk_checksum_method_oauthauthorizationdata_login_url ( ) != 25566 ) {
1170
1262
return InitializationResult . apiChecksumMismatch
1171
1263
}
1172
1264
0 commit comments