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

Use Identity model in ContactFromIdentityProvider

parent d331d628
Branches
Tags
1 merge request!12Use codable models in API
import Bindings
public struct ContactFromIdentityProvider {
public var get: (Data) throws -> Data
public var get: (Identity) throws -> Data
public func callAsFunction(identity: Data) throws -> Data {
public func callAsFunction(identity: Identity) throws -> Data {
try get(identity)
}
}
extension ContactFromIdentityProvider {
public static func live(bindingsClient: BindingsClient) -> ContactFromIdentityProvider {
ContactFromIdentityProvider(get: bindingsClient.getContactFromIdentity(_:))
ContactFromIdentityProvider { identity in
let encoder = JSONEncoder()
let identityData = try encoder.encode(identity)
let contactData = try bindingsClient.getContactFromIdentity(identityData)
return contactData
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment