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

Use MessageSendReport in MessageSender

parent 3e1a515f
No related branches found
No related tags found
1 merge request!12Use codable models in API
import Bindings
public struct MessageSender {
public var send: (Int, Data) throws -> Data
public var send: (Int, Data) throws -> MessageSendReport
public func callAsFunction(
messageType: Int,
payload: Data
) throws -> Data {
) throws -> MessageSendReport {
try send(messageType, payload)
}
}
......@@ -28,7 +28,10 @@ extension MessageSender {
sendE2E: @escaping (Int, Data) throws -> Data
) -> MessageSender {
MessageSender { messageType, payload in
try sendE2E(messageType, payload)
let reportData = try sendE2E(messageType, payload)
let decoder = JSONDecoder()
let report = try decoder.decode(MessageSendReport.self, from: reportData)
return report
}
}
}
......
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