public class HttpJsonRpcClient extends Object implements JsonRpcClient
| Constructor and Description |
|---|
HttpJsonRpcClient(String endpoint)
Construct a new HttpJsonRpcClient.
|
HttpJsonRpcClient(String endpoint,
okhttp3.OkHttpClient client)
Construct a new HttpJsonRpcClient.
|
| Modifier and Type | Method and Description |
|---|---|
<T> JsonRpcResponse<T> |
send(JsonRpcRequest req,
Class<T> resultClass)
Send synchronous Json RPC request to server.
|
void |
send(JsonRpcRequest req,
Class resultClass,
JsonRpcCallback callback)
Send asynchronous Json RPC request to server.
|
<T> List<JsonRpcResponse<T>> |
send(List<JsonRpcRequest> reqs,
Class<T> resultClass)
Send Json RPC request array to server.
|
void |
send(List<JsonRpcRequest> reqs,
Class resultClass,
JsonRpcMultiCallback callback)
Send asynchronous Json RPC request array to server.
|
public HttpJsonRpcClient(String endpoint)
endpoint - the target url endpointpublic HttpJsonRpcClient(String endpoint, okhttp3.OkHttpClient client)
endpoint - the target url endpointclient - the http client instancepublic <T> JsonRpcResponse<T> send(JsonRpcRequest req, Class<T> resultClass) throws IOException
JsonRpcClientJsonRpcClient.send(JsonRpcRequest, Class, JsonRpcCallback) instead.send in interface JsonRpcClientT - The type inference for the result classreq - the JsonRpcRequest objectresultClass - the class for the result. Needs to be a POJO, SerializableIOException - if request failspublic void send(JsonRpcRequest req, Class resultClass, JsonRpcCallback callback)
JsonRpcClientsend in interface JsonRpcClientreq - the JsonRpcRequest objectresultClass - the class for the result. Needs to be a POJO, Serializablecallback - the asynchronous callback which will return the response once received.public <T> List<JsonRpcResponse<T>> send(List<JsonRpcRequest> reqs, Class<T> resultClass) throws IOException
JsonRpcClientsend in interface JsonRpcClientT - The type inference for the result classreqs - the list of JsonRpcRequest objectsresultClass - the class for the result. Needs to be a POJO, SerializableIOException - if client request failspublic void send(List<JsonRpcRequest> reqs, Class resultClass, JsonRpcMultiCallback callback)
JsonRpcClientsend in interface JsonRpcClientreqs - the list of JsonRpcRequest objectsresultClass - the class for the result. Needs to be a POJO, Serializablecallback - the asynchronous callback which will return the response once received.Copyright © 2017. All rights reserved.