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

Add SearchUD functor

parent 144c6a51
No related branches found
No related tags found
1 merge request!102Release 1.0.0
import Bindings
import XCTestDynamicOverlay
public struct SearchUD {
public var run: (Int, Data, [Fact], Data, UdSearchCallback) throws -> SingleUseSendReport
public func callAsFunction(
e2eId: Int,
udContact: Data,
facts: [Fact],
singleRequestParamsJSON: Data,
callback: UdSearchCallback
) throws -> SingleUseSendReport {
try run(e2eId, udContact, facts, singleRequestParamsJSON, callback)
}
}
extension SearchUD {
public static let live = SearchUD {
e2eId, udContact, facts, singleRequestParamsJSON, callback in
var error: NSError?
let reportData = BindingsSearchUD(
e2eId,
udContact,
callback.makeBindingsUdSearchCallback(),
try facts.encode(),
singleRequestParamsJSON,
&error
)
if let error = error {
throw error
}
guard let reportData = reportData else {
fatalError("BindingsSearchUD returned `nil` without providing error")
}
return try SingleUseSendReport.decode(reportData)
}
}
extension SearchUD {
public static let unimplemented = SearchUD(
run: XCTUnimplemented("\(Self.self)")
)
}
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