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 Json RPC request to server.
|
<T> List<JsonRpcResponse<T>> |
send(List<JsonRpcRequest> reqs,
Class<T> resultClass)
Send 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
JsonRpcClientsend 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 <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 failsCopyright © 2016. All rights reserved.