Skip to content

Add async systemOne and models listing returning CompletableFuture - #5

Merged
garretpremo merged 1 commit into
mainfrom
feat/async-api
Sep 19, 2026
Merged

garretpremo merged 1 commit into
mainfrom
feat/async-api

Conversation

@garretpremo

@garretpremo garretpremo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Adds CompletableFuture counterparts to every entry point:

  • systemOneAsync(...) for all six systemOne overloads
  • models().listAsync() and listAsync(RequestOptions)

Blocking and async calls share one attempt path built on HttpClient.sendAsync, with retries scheduled on CompletableFuture.delayedExecutor so backoff never holds a thread; the blocking API is the same future unwrapped by blocking(). Both honor the same per-call RequestOptions and retry policy and report the same TypeSafeException subclasses (serialization, status, timeout, connection, unreadable body, answer validation). Request-setup errors, like a TypeSafeRequest built without state, throw synchronously exactly as they do on the blocking path.

Adds eight async tests, an Async section to the README, and an Unreleased CHANGELOG entry.

Closes #4

Blocking and async calls now share one attempt path: HttpClient.sendAsync
with retries scheduled on CompletableFuture.delayedExecutor, so backoff
never holds a thread; blocking() unwraps the future for the sync API.
Both paths honor the same per-call RequestOptions and retry policy and
report the same TypeSafeException subclasses; request-setup errors still
throw synchronously.
@garretpremo
garretpremo merged commit 380fc9c into main Sep 19, 2026
1 check passed
garretpremo added a commit that referenced this pull request Sep 19, 2026
systemOneAsync mirrors every systemOne overload and models().listAsync()
joins models().list(). Both paths share one attempt loop on
HttpClient.sendAsync with backoff on a delayed executor, honor the same
per-call RequestOptions and retry policy, and fail with the same
TypeSafeException subclasses (#4, #5). READMEs point at 0.3.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an async API returning CompletableFuture

1 participant