Package org.nervos.muta.client.batch
Class BatchClient
- java.lang.Object
-
- org.nervos.muta.client.Client
-
- org.nervos.muta.client.batch.BatchClient
-
public class BatchClient extends Client
A batch client for only GetBlock, GetReceipt and GetTransaction operations Note that GraphQl doesn't support batch mode and doesn't support this kind of 'batch' operation
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
QUERY_NAME
-
Constructor Summary
Constructors Constructor Description BatchClient(java.lang.String url)
BatchClient(java.lang.String url, okhttp3.OkHttpClient okHttpClient)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BatchClient
defaultClient()
java.util.List<BatchQueryResponse>
do_parse(com.fasterxml.jackson.databind.JsonNode dataRoot, java.util.List<BatchQuery> batchQueries)
Handle the tedious work to unmarshall.java.util.List<BatchQueryResponse>
parse_batch(@NonNull okhttp3.Response response, java.util.List<BatchQuery> batchQueries)
Parse results of queries from GraphQl requestjava.util.List<BatchQueryResponse>
query(java.util.List<BatchQuery> batchQueries)
-
Methods inherited from class org.nervos.muta.client.Client
getBlock, getReceipt, getTransaction, parseGraphQlResponse, queryService, send, sendTransaction
-
-
-
-
Method Detail
-
defaultClient
public static BatchClient defaultClient()
-
query
public java.util.List<BatchQueryResponse> query(java.util.List<BatchQuery> batchQueries) throws java.io.IOException
- Parameters:
batchQueries
- The queries, you can give any requests which implementBatchQuery
- Returns:
- The results of queries
- Throws:
java.io.IOException
- GraphQl exception or network exception
-
parse_batch
public java.util.List<BatchQueryResponse> parse_batch(@NonNull @NonNull okhttp3.Response response, java.util.List<BatchQuery> batchQueries) throws java.io.IOException
Parse results of queries from GraphQl request- Parameters:
response
- HTTP responsebatchQueries
- Queries sent, knowing the queries can imply the way how to parse the result- Returns:
- Parsed results
- Throws:
java.io.IOException
- GraphQl exception or network exception
-
do_parse
public java.util.List<BatchQueryResponse> do_parse(com.fasterxml.jackson.databind.JsonNode dataRoot, java.util.List<BatchQuery> batchQueries) throws java.io.IOException
Handle the tedious work to unmarshall. Using instance operator should be faster than refect.- Parameters:
dataRoot
- JSON node rootbatchQueries
- Queries to indicate what the related result format is- Returns:
- Parsed results
- Throws:
java.io.IOException
- GraphQl exception or network exception
-
-