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
No related branches found
No related tags found
1 merge request!12Use codable models in API
import Bindings import Bindings
public struct ContactFromIdentityProvider { 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) try get(identity)
} }
} }
extension ContactFromIdentityProvider { extension ContactFromIdentityProvider {
public static func live(bindingsClient: BindingsClient) -> 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.
Finish editing this message first!
Please register or to comment