@@ -433,6 +433,120 @@ fileprivate struct FfiConverterString: FfiConverter {
433
433
}
434
434
435
435
436
+
437
+
438
+ /**
439
+ * The data needed to perform authorization using OpenID Connect.
440
+ */
441
+ public protocol OidcAuthorizationDataProtocol : AnyObject {
442
+
443
+ /**
444
+ * The login URL to use for authorization.
445
+ */
446
+ func loginUrl( ) -> String
447
+
448
+ }
449
+
450
+ /**
451
+ * The data needed to perform authorization using OpenID Connect.
452
+ */
453
+ open class OidcAuthorizationData :
454
+ OidcAuthorizationDataProtocol {
455
+ fileprivate let pointer : UnsafeMutableRawPointer !
456
+
457
+ /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
458
+ public struct NoPointer {
459
+ public init ( ) { }
460
+ }
461
+
462
+ // TODO: We'd like this to be `private` but for Swifty reasons,
463
+ // we can't implement `FfiConverter` without making this `required` and we can't
464
+ // make it `required` without making it `public`.
465
+ required public init ( unsafeFromRawPointer pointer: UnsafeMutableRawPointer ) {
466
+ self . pointer = pointer
467
+ }
468
+
469
+ /// This constructor can be used to instantiate a fake object.
470
+ /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
471
+ ///
472
+ /// - Warning:
473
+ /// 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.
474
+ public init ( noPointer: NoPointer ) {
475
+ self . pointer = nil
476
+ }
477
+
478
+ public func uniffiClonePointer( ) -> UnsafeMutableRawPointer {
479
+ return try ! rustCall { uniffi_matrix_sdk_fn_clone_oidcauthorizationdata ( self . pointer, $0) }
480
+ }
481
+ // No primary constructor declared for this class.
482
+
483
+ deinit {
484
+ guard let pointer = pointer else {
485
+ return
486
+ }
487
+
488
+ try ! rustCall { uniffi_matrix_sdk_fn_free_oidcauthorizationdata ( pointer, $0) }
489
+ }
490
+
491
+
492
+
493
+
494
+ /**
495
+ * The login URL to use for authorization.
496
+ */
497
+ open func loginUrl( ) -> String {
498
+ return try ! FfiConverterString . lift ( try ! rustCall ( ) {
499
+ uniffi_matrix_sdk_fn_method_oidcauthorizationdata_login_url ( self . uniffiClonePointer ( ) , $0
500
+ )
501
+ } )
502
+ }
503
+
504
+
505
+ }
506
+
507
+ public struct FfiConverterTypeOidcAuthorizationData : FfiConverter {
508
+
509
+ typealias FfiType = UnsafeMutableRawPointer
510
+ typealias SwiftType = OidcAuthorizationData
511
+
512
+ public static func lift( _ pointer: UnsafeMutableRawPointer ) throws -> OidcAuthorizationData {
513
+ return OidcAuthorizationData ( unsafeFromRawPointer: pointer)
514
+ }
515
+
516
+ public static func lower( _ value: OidcAuthorizationData ) -> UnsafeMutableRawPointer {
517
+ return value. uniffiClonePointer ( )
518
+ }
519
+
520
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> OidcAuthorizationData {
521
+ let v : UInt64 = try readInt ( & buf)
522
+ // The Rust code won't compile if a pointer won't fit in a UInt64.
523
+ // We have to go via `UInt` because that's the thing that's the size of a pointer.
524
+ let ptr = UnsafeMutableRawPointer ( bitPattern: UInt ( truncatingIfNeeded: v) )
525
+ if ( ptr == nil ) {
526
+ throw UniffiInternalError . unexpectedNullPointer
527
+ }
528
+ return try lift ( ptr!)
529
+ }
530
+
531
+ public static func write( _ value: OidcAuthorizationData , into buf: inout [ UInt8 ] ) {
532
+ // This fiddling is because `Int` is the thing that's the same size as a pointer.
533
+ // The Rust code won't compile if a pointer won't fit in a `UInt64`.
534
+ writeInt ( & buf, UInt64 ( bitPattern: Int64 ( Int ( bitPattern: lower ( value) ) ) ) )
535
+ }
536
+ }
537
+
538
+
539
+
540
+
541
+ public func FfiConverterTypeOidcAuthorizationData_lift( _ pointer: UnsafeMutableRawPointer ) throws -> OidcAuthorizationData {
542
+ return try FfiConverterTypeOidcAuthorizationData . lift ( pointer)
543
+ }
544
+
545
+ public func FfiConverterTypeOidcAuthorizationData_lower( _ value: OidcAuthorizationData ) -> UnsafeMutableRawPointer {
546
+ return FfiConverterTypeOidcAuthorizationData . lower ( value)
547
+ }
548
+
549
+
436
550
/**
437
551
* A set of common power levels required for various operations within a room,
438
552
* that can be applied as a single operation. When updating these
@@ -1037,6 +1151,9 @@ private var initializationResult: InitializationResult {
1037
1151
if bindings_contract_version != scaffolding_contract_version {
1038
1152
return InitializationResult . contractVersionMismatch
1039
1153
}
1154
+ if ( uniffi_matrix_sdk_checksum_method_oidcauthorizationdata_login_url ( ) != 59213 ) {
1155
+ return InitializationResult . apiChecksumMismatch
1156
+ }
1040
1157
1041
1158
return InitializationResult . ok
1042
1159
}
0 commit comments