EngineClient
public class EngineClient : BaseClient
Responsible for retrieving prediction results from a PredictionIO Engine Server.
-
Creates a client instance to connect to the Engine Server.
Declaration
Swift
public override init(baseURL: String = "http://localhost:8000", timeout: TimeInterval = 5)
Parameters
baseURL
The base URL of the Engine Server.
http://localhost:8000
by default.timeout
The request timeout. 5 seconds by default.
Return Value
The
EngineClient
instance.
-
Queries the prediction engine.
Declaration
Swift
public func sendQuery(_ query: [String: Any], completionHandler: @escaping (Result<Data, PIOError>) -> Void)
Parameters
query
The query dictionary.
completionHandler
The callback to be executed when the request has finished.
-
Queries the prediction engine and parses the response into the given response type.
Declaration
Swift
public func sendQuery<Response>(_ query: [String: Any], responseType: Response.Type, completionHandler: @escaping (Result<Response, PIOError>) -> Void) where Response: Decodable
Parameters
query
The query dictionary.
responseType
The type respresenting the response format. It must conform to
Decodable
.completionHandler
The callback to be executed when the request has finished.