Skip to content
Snippets Groups Projects
Commit c43ec974 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Add GroupChatMakeGroup functor

parent 0f4cb344
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!25Update Bindings
import Bindings
import XCTestDynamicOverlay
public struct GroupChatMakeGroup {
public var run: ([Data], Data?, Data?) throws -> GroupReport
public func callAsFunction(
membership: [Data],
message: Data?,
name: Data?
) throws -> GroupReport {
try run(membership, message, name)
}
}
extension GroupChatMakeGroup {
public static func live(_ bindingsGroupChat: BindingsGroupChat) -> GroupChatMakeGroup {
GroupChatMakeGroup { membership, message, name in
let reportData = try bindingsGroupChat.makeGroup(
try JSONEncoder().encode(membership),
message: message,
name: name
)
return try GroupReport.decode(reportData)
}
}
}
extension GroupChatMakeGroup {
public static let unimplemented = GroupChatMakeGroup(
run: XCTUnimplemented("\(Self.self)")
)
}
...@@ -3,6 +3,7 @@ import Bindings ...@@ -3,6 +3,7 @@ import Bindings
public struct GroupChat { public struct GroupChat {
public var getGroup: GroupChatGetGroup public var getGroup: GroupChatGetGroup
public var getGroups: GroupChatGetGroups public var getGroups: GroupChatGetGroups
public var makeGroup: GroupChatMakeGroup
public var joinGroup: GroupChatJoinGroup public var joinGroup: GroupChatJoinGroup
public var leaveGroup: GroupChatLeaveGroup public var leaveGroup: GroupChatLeaveGroup
public var numGroups: GroupChatNumGroups public var numGroups: GroupChatNumGroups
...@@ -15,6 +16,7 @@ extension GroupChat { ...@@ -15,6 +16,7 @@ extension GroupChat {
GroupChat( GroupChat(
getGroup: .live(bindingsGroupChat), getGroup: .live(bindingsGroupChat),
getGroups: .live(bindingsGroupChat), getGroups: .live(bindingsGroupChat),
makeGroup: .live(bindingsGroupChat),
joinGroup: .live(bindingsGroupChat), joinGroup: .live(bindingsGroupChat),
leaveGroup: .live(bindingsGroupChat), leaveGroup: .live(bindingsGroupChat),
numGroups: .live(bindingsGroupChat), numGroups: .live(bindingsGroupChat),
...@@ -28,6 +30,7 @@ extension GroupChat { ...@@ -28,6 +30,7 @@ extension GroupChat {
public static let unimplemented = GroupChat( public static let unimplemented = GroupChat(
getGroup: .unimplemented, getGroup: .unimplemented,
getGroups: .unimplemented, getGroups: .unimplemented,
makeGroup: .unimplemented,
joinGroup: .unimplemented, joinGroup: .unimplemented,
leaveGroup: .unimplemented, leaveGroup: .unimplemented,
numGroups: .unimplemented, numGroups: .unimplemented,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment