diff --git a/Sources/ElixxirDAppsSDK/Functors/RegisterForNotifications.swift b/Sources/ElixxirDAppsSDK/Functors/RegisterForNotifications.swift new file mode 100644 index 0000000000000000000000000000000000000000..16d3162c4cb709cbef8c6f0e86120cdcb1312889 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/Functors/RegisterForNotifications.swift @@ -0,0 +1,29 @@ +import Bindings +import XCTestDynamicOverlay + +public struct RegisterForNotifications { + public var run: (Int, String) throws -> Void + + public func callAsFunction( + e2eId: Int, + token: String + ) throws { + try run(e2eId, token) + } +} + +extension RegisterForNotifications { + public static let live = RegisterForNotifications { e2eId, token in + var error: NSError? + BindingsRegisterForNotifications(e2eId, token, &error) + if let error = error { + throw error + } + } +} + +extension RegisterForNotifications { + public static let unimplemented = RegisterForNotifications( + run: XCTUnimplemented("\(Self.self)") + ) +}