@@ -465,6 +465,16 @@ public protocol FirefoxAccountProtocol: AnyObject {
465
465
466
466
func clearDeviceName( ) throws
467
467
468
+ /**
469
+ * Use device commands to close one or more tabs on another device.
470
+ *
471
+ * **💾 This method alters the persisted account state.**
472
+ *
473
+ * If a device on the account has registered the [`CloseTabs`](DeviceCapability::CloseTabs)
474
+ * capability, this method can be used to close its tabs.
475
+ */
476
+ func closeTabs( targetDeviceId: String , urls: [ String ] ) throws
477
+
468
478
func completeOauthFlow( code: String , state: String ) throws
469
479
470
480
func disconnect( )
@@ -624,6 +634,21 @@ open class FirefoxAccount:
624
634
}
625
635
}
626
636
637
+ /**
638
+ * Use device commands to close one or more tabs on another device.
639
+ *
640
+ * **💾 This method alters the persisted account state.**
641
+ *
642
+ * If a device on the account has registered the [`CloseTabs`](DeviceCapability::CloseTabs)
643
+ * capability, this method can be used to close its tabs.
644
+ */
645
+ open func closeTabs( targetDeviceId: String , urls: [ String ] ) throws { try rustCallWithError ( FfiConverterTypeFxaError . lift) {
646
+ uniffi_fxa_client_fn_method_firefoxaccount_close_tabs ( self . uniffiClonePointer ( ) ,
647
+ FfiConverterString . lower ( targetDeviceId) ,
648
+ FfiConverterSequenceString . lower ( urls) , $0)
649
+ }
650
+ }
651
+
627
652
open func completeOauthFlow( code: String , state: String ) throws { try rustCallWithError ( FfiConverterTypeFxaError . lift) {
628
653
uniffi_fxa_client_fn_method_firefoxaccount_complete_oauth_flow ( self . uniffiClonePointer ( ) ,
629
654
FfiConverterString . lower ( code) ,
@@ -1285,6 +1310,60 @@ public func FfiConverterTypeAuthorizationParameters_lower(_ value: Authorization
1285
1310
return FfiConverterTypeAuthorizationParameters . lower ( value)
1286
1311
}
1287
1312
1313
+ /**
1314
+ * The payload sent when invoking a "close tabs" command.
1315
+ */
1316
+ public struct CloseTabsPayload {
1317
+ /**
1318
+ * The URLs of the tabs to close.
1319
+ */
1320
+ public var urls : [ String ]
1321
+
1322
+ // Default memberwise initializers are never public by default, so we
1323
+ // declare one manually.
1324
+ public init (
1325
+ /**
1326
+ * The URLs of the tabs to close.
1327
+ */ urls: [ String ]
1328
+ ) {
1329
+ self . urls = urls
1330
+ }
1331
+ }
1332
+
1333
+ extension CloseTabsPayload : Equatable , Hashable {
1334
+ public static func == ( lhs: CloseTabsPayload , rhs: CloseTabsPayload ) -> Bool {
1335
+ if lhs. urls != rhs. urls {
1336
+ return false
1337
+ }
1338
+ return true
1339
+ }
1340
+
1341
+ public func hash( into hasher: inout Hasher ) {
1342
+ hasher. combine ( urls)
1343
+ }
1344
+ }
1345
+
1346
+ public struct FfiConverterTypeCloseTabsPayload : FfiConverterRustBuffer {
1347
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> CloseTabsPayload {
1348
+ return
1349
+ try CloseTabsPayload (
1350
+ urls: FfiConverterSequenceString . read ( from: & buf)
1351
+ )
1352
+ }
1353
+
1354
+ public static func write( _ value: CloseTabsPayload , into buf: inout [ UInt8 ] ) {
1355
+ FfiConverterSequenceString . write ( value. urls, into: & buf)
1356
+ }
1357
+ }
1358
+
1359
+ public func FfiConverterTypeCloseTabsPayload_lift( _ buf: RustBuffer ) throws -> CloseTabsPayload {
1360
+ return try FfiConverterTypeCloseTabsPayload . lift ( buf)
1361
+ }
1362
+
1363
+ public func FfiConverterTypeCloseTabsPayload_lower( _ value: CloseTabsPayload ) -> RustBuffer {
1364
+ return FfiConverterTypeCloseTabsPayload . lower ( value)
1365
+ }
1366
+
1288
1367
public struct Device {
1289
1368
public var id : String
1290
1369
public var displayName : String
@@ -2067,6 +2146,7 @@ extension AccountEvent: Equatable, Hashable {}
2067
2146
2068
2147
public enum DeviceCapability {
2069
2148
case sendTab
2149
+ case closeTabs
2070
2150
}
2071
2151
2072
2152
public struct FfiConverterTypeDeviceCapability : FfiConverterRustBuffer {
@@ -2077,6 +2157,8 @@ public struct FfiConverterTypeDeviceCapability: FfiConverterRustBuffer {
2077
2157
switch variant {
2078
2158
case 1 : return . sendTab
2079
2159
2160
+ case 2 : return . closeTabs
2161
+
2080
2162
default : throw UniffiInternalError . unexpectedEnumCase
2081
2163
}
2082
2164
}
@@ -2085,6 +2167,9 @@ public struct FfiConverterTypeDeviceCapability: FfiConverterRustBuffer {
2085
2167
switch value {
2086
2168
case . sendTab:
2087
2169
writeInt ( & buf, Int32 ( 1 ) )
2170
+
2171
+ case . closeTabs:
2172
+ writeInt ( & buf, Int32 ( 2 ) )
2088
2173
}
2089
2174
}
2090
2175
}
@@ -2678,6 +2763,10 @@ extension FxaStateCheckerState: Equatable, Hashable {}
2678
2763
2679
2764
public enum IncomingDeviceCommand {
2680
2765
case tabReceived( sender: Device ? , payload: SendTabPayload )
2766
+ /**
2767
+ * Indicates that the sender wants to close one or more tabs on this device.
2768
+ */
2769
+ case tabsClosed( sender: Device ? , payload: CloseTabsPayload )
2681
2770
}
2682
2771
2683
2772
public struct FfiConverterTypeIncomingDeviceCommand : FfiConverterRustBuffer {
@@ -2688,6 +2777,8 @@ public struct FfiConverterTypeIncomingDeviceCommand: FfiConverterRustBuffer {
2688
2777
switch variant {
2689
2778
case 1 : return try . tabReceived( sender: FfiConverterOptionTypeDevice . read ( from: & buf) , payload: FfiConverterTypeSendTabPayload . read ( from: & buf) )
2690
2779
2780
+ case 2 : return try . tabsClosed( sender: FfiConverterOptionTypeDevice . read ( from: & buf) , payload: FfiConverterTypeCloseTabsPayload . read ( from: & buf) )
2781
+
2691
2782
default : throw UniffiInternalError . unexpectedEnumCase
2692
2783
}
2693
2784
}
@@ -2698,6 +2789,11 @@ public struct FfiConverterTypeIncomingDeviceCommand: FfiConverterRustBuffer {
2698
2789
writeInt ( & buf, Int32 ( 1 ) )
2699
2790
FfiConverterOptionTypeDevice . write ( sender, into: & buf)
2700
2791
FfiConverterTypeSendTabPayload . write ( payload, into: & buf)
2792
+
2793
+ case let . tabsClosed( sender, payload) :
2794
+ writeInt ( & buf, Int32 ( 2 ) )
2795
+ FfiConverterOptionTypeDevice . write ( sender, into: & buf)
2796
+ FfiConverterTypeCloseTabsPayload . write ( payload, into: & buf)
2701
2797
}
2702
2798
}
2703
2799
}
@@ -3004,6 +3100,9 @@ private var initializationResult: InitializationResult {
3004
3100
if uniffi_fxa_client_checksum_method_firefoxaccount_clear_device_name ( ) != 42324 {
3005
3101
return InitializationResult . apiChecksumMismatch
3006
3102
}
3103
+ if uniffi_fxa_client_checksum_method_firefoxaccount_close_tabs ( ) != 64219 {
3104
+ return InitializationResult . apiChecksumMismatch
3105
+ }
3007
3106
if uniffi_fxa_client_checksum_method_firefoxaccount_complete_oauth_flow ( ) != 41338 {
3008
3107
return InitializationResult . apiChecksumMismatch
3009
3108
}
0 commit comments