From 1648dbf6039d0b5990d9bd1ca86727d3bc8224f0 Mon Sep 17 00:00:00 2001
From: Dariusz Rybicki <dariusz@elixxir.io>
Date: Mon, 25 Jul 2022 17:27:40 +0100
Subject: [PATCH] Add E2EResetAuthenticatedChannel functor

---
 Sources/ElixxirDAppsSDK/E2E.swift             |  3 +++
 .../E2EResetAuthenticatedChannel.swift        | 26 +++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 Sources/ElixxirDAppsSDK/E2EResetAuthenticatedChannel.swift

diff --git a/Sources/ElixxirDAppsSDK/E2E.swift b/Sources/ElixxirDAppsSDK/E2E.swift
index b11f08e2..e24d04ce 100644
--- a/Sources/ElixxirDAppsSDK/E2E.swift
+++ b/Sources/ElixxirDAppsSDK/E2E.swift
@@ -14,6 +14,7 @@ public struct E2E {
   public var removeService: E2ERemoveService
   public var hasAuthenticatedChannel: E2EHasAuthenticatedChannel
   public var requestAuthenticatedChannel: E2ERequestAuthenticatedChannel
+  public var resetAuthenticatedChannel: E2EResetAuthenticatedChannel
   public var callAllReceivedRequests: E2ECallAllReceivedRequests
   public var send: E2ESend
 
@@ -36,6 +37,7 @@ extension E2E {
       removeService: .live(bindingsE2E),
       hasAuthenticatedChannel: .live(bindingsE2E),
       requestAuthenticatedChannel: .live(bindingsE2E),
+      resetAuthenticatedChannel: .live(bindingsE2E),
       callAllReceivedRequests: .live(bindingsE2E),
       send: .live(bindingsE2E)
     )
@@ -57,6 +59,7 @@ extension E2E {
     removeService: .unimplemented,
     hasAuthenticatedChannel: .unimplemented,
     requestAuthenticatedChannel: .unimplemented,
+    resetAuthenticatedChannel: .unimplemented,
     callAllReceivedRequests: .unimplemented,
     send: .unimplemented
   )
diff --git a/Sources/ElixxirDAppsSDK/E2EResetAuthenticatedChannel.swift b/Sources/ElixxirDAppsSDK/E2EResetAuthenticatedChannel.swift
new file mode 100644
index 00000000..7b987fc9
--- /dev/null
+++ b/Sources/ElixxirDAppsSDK/E2EResetAuthenticatedChannel.swift
@@ -0,0 +1,26 @@
+import Bindings
+import XCTestDynamicOverlay
+
+public struct E2EResetAuthenticatedChannel {
+  public var run: (Data) throws -> Int64
+
+  public func callAsFunction(partnerContact: Data) throws -> Int64 {
+    try run(partnerContact)
+  }
+}
+
+extension E2EResetAuthenticatedChannel {
+  public static func live(_ bindingsE2E: BindingsE2e) -> E2EResetAuthenticatedChannel {
+    E2EResetAuthenticatedChannel { partnerContact in
+      var roundId: Int64 = 0
+      try bindingsE2E.reset(partnerContact, ret0_: &roundId)
+      return roundId
+    }
+  }
+}
+
+extension E2EResetAuthenticatedChannel {
+  public static let unimplemented = E2EResetAuthenticatedChannel(
+    run: XCTUnimplemented("\(Self.self)")
+  )
+}
-- 
GitLab