code: public QueryResponse query(QueryRequest request) throws IOException {
          QueryResponse queryResponse = new QueryResponse(client.doGet(request.toUrl()));
          if (queryResponse.wasSuccessful()) {
              int receivedRecords = request.getPageSize();
              while (receivedRecords < request.getLimit() &&
                      (receivedRecords + request.getStart() - 1) < queryResponse.getTotalResultCount()) {
                  QueryRequest pageRequest = request.clone();
                  pageRequest.setStart(receivedRecords + request.getStart());
                  QueryResponse pageResponse = new QueryResponse(client.doGet(pageRequest.toUrl()));
                  if (pageResponse.wasSuccessful()) {
                      JsonArray results = queryResponse.getResults();
                      results.addAll(pageResponse.getResults());
                      receivedRecords += pageRequest.getPageSize();
                  }
              }
          }
  
          return queryResponse;
      }
docs: Query for objects matching the specified request.
  By default one page of data will be returned.
  Paging will automatically be performed if a limit is set on the request.
  
  @param request the {@link QueryRequest} specifying the object to be created.
  @return the resulting {@link QueryResponse}
  @throws IOException if an error occurs during the query.