diff --git a/Sources/ElixxirDAppsSDK/Cmix/Functors/CmixWaitForMessageDelivery.swift b/Sources/ElixxirDAppsSDK/Cmix/Functors/CmixWaitForMessageDelivery.swift index e326a279a7a6f53afe1b08cff5b0972073ec9a7a..967c517ba71735f9634e9544c3dd2cb9574d7574 100644 --- a/Sources/ElixxirDAppsSDK/Cmix/Functors/CmixWaitForMessageDelivery.swift +++ b/Sources/ElixxirDAppsSDK/Cmix/Functors/CmixWaitForMessageDelivery.swift @@ -2,10 +2,10 @@ import Bindings import XCTestDynamicOverlay public struct CmixWaitForMessageDelivery { - public var run: (MessageSendReport, Int, MessageDeliveryCallback) throws -> Void + public var run: (E2ESendReport, Int, MessageDeliveryCallback) throws -> Void public func callAsFunction( - report: MessageSendReport, + report: E2ESendReport, timeoutMS: Int, callback: MessageDeliveryCallback ) throws { diff --git a/Sources/ElixxirDAppsSDK/Connection/Functors/ConnectionSend.swift b/Sources/ElixxirDAppsSDK/Connection/Functors/ConnectionSend.swift index 7d4061d85faa08ad560aedd543f577b6d3cf724a..c94ce34e3d195e04cb702a01f04495046ed07195 100644 --- a/Sources/ElixxirDAppsSDK/Connection/Functors/ConnectionSend.swift +++ b/Sources/ElixxirDAppsSDK/Connection/Functors/ConnectionSend.swift @@ -2,12 +2,12 @@ import Bindings import XCTestDynamicOverlay public struct ConnectionSend { - public var run: (Int, Data) throws -> MessageSendReport + public var run: (Int, Data) throws -> E2ESendReport public func callAsFunction( messageType: Int, payload: Data - ) throws -> MessageSendReport { + ) throws -> E2ESendReport { try run(messageType, payload) } } @@ -15,7 +15,7 @@ public struct ConnectionSend { extension ConnectionSend { public static func live(_ bindingsConnection: BindingsConnection) -> ConnectionSend { ConnectionSend { messageType, payload in - try MessageSendReport.decode( + try E2ESendReport.decode( bindingsConnection.sendE2E(messageType, payload: payload) ) } @@ -23,7 +23,7 @@ extension ConnectionSend { public static func live(_ bindingsConnection: BindingsAuthenticatedConnection) -> ConnectionSend { ConnectionSend { messageType, payload in - try MessageSendReport.decode( + try E2ESendReport.decode( bindingsConnection.sendE2E(messageType, payload: payload) ) } diff --git a/Sources/ElixxirDAppsSDK/Models/MessageSendReport.swift b/Sources/ElixxirDAppsSDK/Models/E2ESendReport.swift similarity index 88% rename from Sources/ElixxirDAppsSDK/Models/MessageSendReport.swift rename to Sources/ElixxirDAppsSDK/Models/E2ESendReport.swift index be8d383384c252422fb9a4e1833b0e838d98c91e..87ab2e49371b96a3e96fa03d2bb9ee41860104a1 100644 --- a/Sources/ElixxirDAppsSDK/Models/MessageSendReport.swift +++ b/Sources/ElixxirDAppsSDK/Models/E2ESendReport.swift @@ -1,6 +1,6 @@ import Foundation -public struct MessageSendReport: Equatable { +public struct E2ESendReport: Equatable { public init( roundList: [Int]?, messageId: Data?, @@ -16,7 +16,7 @@ public struct MessageSendReport: Equatable { public var timestamp: Int? } -extension MessageSendReport: Codable { +extension E2ESendReport: Codable { enum CodingKeys: String, CodingKey { case roundList = "Rounds" case messageId = "MessageID" diff --git a/Tests/ElixxirDAppsSDKTests/Models/MessageSendReportTests.swift b/Tests/ElixxirDAppsSDKTests/Models/E2ESendReportTests.swift similarity index 72% rename from Tests/ElixxirDAppsSDKTests/Models/MessageSendReportTests.swift rename to Tests/ElixxirDAppsSDKTests/Models/E2ESendReportTests.swift index f1852dd39c90c75820949f51e07acf2d641c8e9b..db3bdd3bac97e7e5ff2e1830abe19fd4f6ec230a 100644 --- a/Tests/ElixxirDAppsSDKTests/Models/MessageSendReportTests.swift +++ b/Tests/ElixxirDAppsSDKTests/Models/E2ESendReportTests.swift @@ -2,7 +2,7 @@ import CustomDump import XCTest @testable import ElixxirDAppsSDK -final class MessageSendReportTests: XCTestCase { +final class E2ESendReportTests: XCTestCase { func testCoding() throws { let rounds = [1, 5, 9] let messageIdB64 = "51Yy47uZbP0o2Y9B/kkreDLTB6opUol3M3mYiY2dcdQ=" @@ -15,16 +15,16 @@ final class MessageSendReportTests: XCTestCase { } """ let jsonData = jsonString.data(using: .utf8)! - let model = try MessageSendReport.decode(jsonData) + let model = try E2ESendReport.decode(jsonData) - XCTAssertNoDifference(model, MessageSendReport( + XCTAssertNoDifference(model, E2ESendReport( roundList: rounds, messageId: Data(base64Encoded: messageIdB64)!, timestamp: timestamp )) let encodedModel = try model.encode() - let decodedModel = try MessageSendReport.decode(encodedModel) + let decodedModel = try E2ESendReport.decode(encodedModel) XCTAssertNoDifference(decodedModel, model) } @@ -32,9 +32,9 @@ final class MessageSendReportTests: XCTestCase { func testDecodeEmpty() throws { let jsonString = "{}" let jsonData = jsonString.data(using: .utf8)! - let model = try MessageSendReport.decode(jsonData) + let model = try E2ESendReport.decode(jsonData) - XCTAssertNoDifference(model, MessageSendReport( + XCTAssertNoDifference(model, E2ESendReport( roundList: nil, messageId: nil, timestamp: nil