diff --git a/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatGetGroup.swift b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatGetGroup.swift new file mode 100644 index 0000000000000000000000000000000000000000..e4d5a5eedaa70e823c6cbd4cfbb67bb99f093620 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatGetGroup.swift @@ -0,0 +1,24 @@ +import Bindings +import XCTestDynamicOverlay + +public struct GroupChatGetGroup { + public var run: (Data) throws -> Group + + public func callAsFunction(groupId: Data) throws -> Group { + try run(groupId) + } +} + +extension GroupChatGetGroup { + public static func live(_ bindingsGroupChat: BindingsGroupChat) -> GroupChatGetGroup { + GroupChatGetGroup { groupId in + .live(try bindingsGroupChat.getGroup(groupId)) + } + } +} + +extension GroupChatGetGroup { + public static let unimplemented = GroupChatGetGroup( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatGetGroups.swift b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatGetGroups.swift new file mode 100644 index 0000000000000000000000000000000000000000..02d29af296ffe837618888b7dfeedc11066999af --- /dev/null +++ b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatGetGroups.swift @@ -0,0 +1,25 @@ +import Bindings +import XCTestDynamicOverlay + +public struct GroupChatGetGroups { + public var run: () throws -> [Data] + + public func callAsFunction() throws -> [Data] { + try run() + } +} + +extension GroupChatGetGroups { + public static func live(_ bindingsGroupChat: BindingsGroupChat) -> GroupChatGetGroups { + GroupChatGetGroups { + let listData = try bindingsGroupChat.getGroups() + return try JSONDecoder().decode([Data].self, from: listData) + } + } +} + +extension GroupChatGetGroups { + public static let unimplemented = GroupChatGetGroups( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatJoinGroup.swift b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatJoinGroup.swift new file mode 100644 index 0000000000000000000000000000000000000000..a69160396532f608e4014fb89a9930da755b597f --- /dev/null +++ b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatJoinGroup.swift @@ -0,0 +1,22 @@ +import Bindings +import XCTestDynamicOverlay + +public struct GroupChatJoinGroup { + public var run: (Int) throws -> Void + + public func callAsFunction(trackedGroupId: Int) throws { + try run(trackedGroupId) + } +} + +extension GroupChatJoinGroup { + public static func live(_ bindingsGroupChat: BindingsGroupChat) -> GroupChatJoinGroup { + GroupChatJoinGroup(run: bindingsGroupChat.joinGroup) + } +} + +extension GroupChatJoinGroup { + public static let unimplemented = GroupChatJoinGroup( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatLeaveGroup.swift b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatLeaveGroup.swift new file mode 100644 index 0000000000000000000000000000000000000000..e13626065df4dcd7fa8788bd336fac71b6fb9b10 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatLeaveGroup.swift @@ -0,0 +1,22 @@ +import Bindings +import XCTestDynamicOverlay + +public struct GroupChatLeaveGroup { + public var run: (Data) throws -> Void + + public func callAsFunction(groupId: Data) throws { + try run(groupId) + } +} + +extension GroupChatLeaveGroup { + public static func live(_ bindingsGroupChat: BindingsGroupChat) -> GroupChatLeaveGroup { + GroupChatLeaveGroup(run: bindingsGroupChat.leaveGroup) + } +} + +extension GroupChatLeaveGroup { + public static let unimplemented = GroupChatLeaveGroup( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatNumGroups.swift b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatNumGroups.swift new file mode 100644 index 0000000000000000000000000000000000000000..f0c4d071384df5638e936bbf635e1f12c893cbc2 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatNumGroups.swift @@ -0,0 +1,22 @@ +import Bindings +import XCTestDynamicOverlay + +public struct GroupChatNumGroups { + public var run: () -> Int + + public func callAsFunction() -> Int { + run() + } +} + +extension GroupChatNumGroups { + public static func live(_ bindingsGroupChat: BindingsGroupChat) -> GroupChatNumGroups { + GroupChatNumGroups(run: bindingsGroupChat.numGroups) + } +} + +extension GroupChatNumGroups { + public static let unimplemented = GroupChatNumGroups( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatResendRequest.swift b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatResendRequest.swift new file mode 100644 index 0000000000000000000000000000000000000000..817ea59e4ccb2a0e0cd68270dbe3d64714887947 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatResendRequest.swift @@ -0,0 +1,25 @@ +import Bindings +import XCTestDynamicOverlay + +public struct GroupChatResendRequest { + public var run: (Data) throws -> GroupReport + + public func callAsFunction(groupId: Data) throws -> GroupReport { + try run(groupId) + } +} + +extension GroupChatResendRequest { + public static func live(_ bindingsGroupChat: BindingsGroupChat) -> GroupChatResendRequest { + GroupChatResendRequest { groupId in + let reportData = try bindingsGroupChat.resendRequest(groupId) + return try GroupReport.decode(reportData) + } + } +} + +extension GroupChatResendRequest { + public static let unimplemented = GroupChatResendRequest( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatSend.swift b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatSend.swift new file mode 100644 index 0000000000000000000000000000000000000000..6e2f79526b88b27dc85f40bef8b61daefaa30be2 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/GroupChat/Functors/GroupChatSend.swift @@ -0,0 +1,29 @@ +import Bindings +import XCTestDynamicOverlay + +public struct GroupChatSend { + public var run: (Data, Data, String?) throws -> GroupSendReport + + public func callAsFunction( + groupId: Data, + message: Data, + tag: String? = nil + ) throws -> GroupSendReport { + try run(groupId, message, tag) + } +} + +extension GroupChatSend { + public static func live(_ bindingsGroupChat: BindingsGroupChat) -> GroupChatSend { + GroupChatSend { groupId, message, tag in + let reportData = try bindingsGroupChat.send(groupId, message: message, tag: tag) + return try GroupSendReport.decode(reportData) + } + } +} + +extension GroupChatSend { + public static let unimplemented = GroupChatSend( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/GroupChat/GroupChat.swift b/Sources/ElixxirDAppsSDK/GroupChat/GroupChat.swift new file mode 100644 index 0000000000000000000000000000000000000000..10f24edf28af41e468c5e0573a9cb12c01ac960e --- /dev/null +++ b/Sources/ElixxirDAppsSDK/GroupChat/GroupChat.swift @@ -0,0 +1,37 @@ +import Bindings + +public struct GroupChat { + public var getGroup: GroupChatGetGroup + public var getGroups: GroupChatGetGroups + public var joinGroup: GroupChatJoinGroup + public var leaveGroup: GroupChatLeaveGroup + public var numGroups: GroupChatNumGroups + public var resendRequest: GroupChatResendRequest + public var send: GroupChatSend +} + +extension GroupChat { + public static func live(_ bindingsGroupChat: BindingsGroupChat) -> GroupChat { + GroupChat( + getGroup: .live(bindingsGroupChat), + getGroups: .live(bindingsGroupChat), + joinGroup: .live(bindingsGroupChat), + leaveGroup: .live(bindingsGroupChat), + numGroups: .live(bindingsGroupChat), + resendRequest: .live(bindingsGroupChat), + send: .live(bindingsGroupChat) + ) + } +} + +extension GroupChat { + public static let unimplemented = GroupChat( + getGroup: .unimplemented, + getGroups: .unimplemented, + joinGroup: .unimplemented, + leaveGroup: .unimplemented, + numGroups: .unimplemented, + resendRequest: .unimplemented, + send: .unimplemented + ) +}