From ab7c90269f08500059bdd00576bd809344c66e9e Mon Sep 17 00:00:00 2001
From: Dariusz Rybicki <dariusz@elixxir.io>
Date: Fri, 19 Aug 2022 18:25:01 +0100
Subject: [PATCH] Add RegisterForNotifications functor

---
 .../Functors/RegisterForNotifications.swift   | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Sources/ElixxirDAppsSDK/Functors/RegisterForNotifications.swift

diff --git a/Sources/ElixxirDAppsSDK/Functors/RegisterForNotifications.swift b/Sources/ElixxirDAppsSDK/Functors/RegisterForNotifications.swift
new file mode 100644
index 00000000..16d3162c
--- /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)")
+  )
+}
-- 
GitLab