Class 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 Detail

      • QUERY_NAME

        public static java.lang.String QUERY_NAME
    • Constructor Detail

      • BatchClient

        public BatchClient​(java.lang.String url)
      • BatchClient

        public BatchClient​(java.lang.String url,
                           okhttp3.OkHttpClient okHttpClient)
    • 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 implement BatchQuery
        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 response
        batchQueries - 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 root
        batchQueries - Queries to indicate what the related result format is
        Returns:
        Parsed results
        Throws:
        java.io.IOException - GraphQl exception or network exception