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

Wrap GroupChat object

parent fb779199
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!24Update Bindings
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)")
)
}
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)")
)
}
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)")
)
}
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)")
)
}
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)")
)
}
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)")
)
}
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)")
)
}
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
)
}
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