Skip to content

Commit

Permalink
Reorder some methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Griffin committed Sep 20, 2024
1 parent c098a15 commit ac6d172
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/com/fauna/client/FaunaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ public Optional<Long> getLastTransactionTs() {
return ts > 0 ? Optional.of(ts) : Optional.empty();
}

private <T> Supplier<CompletableFuture<QuerySuccess<T>>> makeAsyncRequest(HttpClient client, HttpRequest request, Codec<T> codec) {
return () -> client.sendAsync(request, HttpResponse.BodyHandlers.ofInputStream()).thenApply(body -> QueryResponse.parseResponse(body, codec)).whenComplete(this::completeRequest);
}

private static Optional<ServiceException> extractServiceException(Throwable throwable) {
if (throwable.getCause() instanceof ServiceException) {
return Optional.of((ServiceException) throwable.getCause());
Expand All @@ -78,6 +74,11 @@ private <T> void completeRequest(QuerySuccess<T> success, Throwable throwable) {
}
}

private <T> Supplier<CompletableFuture<QuerySuccess<T>>> makeAsyncRequest(HttpClient client, HttpRequest request, Codec<T> codec) {
return () -> client.sendAsync(request, HttpResponse.BodyHandlers.ofInputStream()).thenApply(body -> QueryResponse.parseResponse(body, codec)).whenComplete(this::completeRequest);
}


//region Asynchronous API
/**
* Sends an asynchronous Fauna Query Language (FQL) query to Fauna.
Expand Down

0 comments on commit ac6d172

Please sign in to comment.