jackson-databind).
HTTP goes through the JDK java.net.http.HttpClient, so you can pass your own configured client.
Every call has a blocking form, a ...WithResponse form (status, headers, request id, credits) and a ...Async form.
For the options shared by all SDKs, see the SDKs overview.
Install
Check out the repository, change intojava/ and run the build and tests.
After release: Maven and Gradle coordinates
After release: Maven and Gradle coordinates
These are the intended coordinates. They do not resolve today.Maven:Gradle (Kotlin DSL):Gradle (Groovy):
Vaquill-AI/vaquill-sdks, java/ on GitHub.
Quickstart
client.statutes(), client.sessionLaws(), client.watches(), client.boards(), client.credits(), client.pricing().
Request bodies are built with Model.builder(), and optional query parameters with ...Params.builder().
Responses are plain models. Members this SDK version does not know about are kept in getAdditionalProperties() and survive a round trip.
Client options
Per call, pass
RequestOptions as the last argument: timeout, maxRetries, idempotencyKey and extra headers.
client.toBuilder() derives a client that shares the same spend guard.
The User-Agent is vaquill-java/<version>.
Response metadata
Async
Errors
Every failure is an uncheckedVaquillException.
IdempotencyConflict is a marker interface implemented by the three idempotency exceptions, so a catch block can match them with an instanceof check.
The 422 message is Validation failed: followed by the first rejected fields, for example body: Field required.
A 2xx whose body is not the documented JSON raises ResponseParseException.
A Deprecation or Sunset response header logs one warning per endpoint.
Retries and idempotency
The SDKs retry408, 429 and 5xx responses, plus a 409 only for idempotency_in_progress.
Connection errors and timeouts are retried when it is safe to do so.
The default is 2 retries, and setting the retry limit to 0 turns retries off.
Backoff starts at 0.5 seconds, doubles to an 8 second cap and is scaled down by 0 to 25 percent jitter.
The wait comes from the retry-after-ms header first, then Retry-After (seconds or an HTTP date), then the body’s retryAfterSeconds.
A wait above 120 seconds is not slept: the error is raised at once.
Never retried: a 402 insufficient_credits, daily_cap_exceeded, any other 4xx, and anything the server marks retryable: false.
Java specifics:
- Retried by code:
rate_limited,idempotency_in_progress,upstream_timeout,service_unavailableandinternal_error, and otherwise by status 408, 429 and 5xx. 501 is not retried. - Connect failures are always retried. Any other transport error is retried only for GET and HEAD, or when the request carries an Idempotency-Key, because the server may already have done the work.
- A 5xx on a charged call is not retried without a key, for the same reason.
Idempotency-Key header on its operation.
The SDKs derive the list of charged calls from the API contract, and prices are not hard-coded in them.
Each charged call sends one generated Idempotency-Key, reused on every retry of that call.
When the server honours the key it replays the stored response instead of charging again, and the response reports that it was replayed.
Pass your own key to choose it.
The SDK generates a key for every charged POST unless you pass your own with RequestOptions.builder().idempotencyKey("...").
A key must be 16 to 255 visible ASCII characters. An empty or malformed key is rejected before anything is sent.
Response.isIdempotentReplayed() is true when the server answered from a stored result, and a replay counts as 0 credits against the spend guard.
Spend guard
SpendGuardExceededException and is never sent.
client.getCreditsSpent() returns the total. Free endpoints are never blocked.
Pagination and batch helpers
Every paginated endpoint has aniter... method returning a Paginator<T>.
maxPages(n)andmaxItems(n)set limits before iteration starts. Afterwards they throwIllegalStateException.isTruncated()reports that a limit stopped the walk.isStuck()is true when the server repeated a cursor or offset, or returned an empty page claiming more. Iteration stops instead of looping forever.pages()iterates page by page.- A paginator is single use and not thread safe.
statutes().iterSearch / iterDivisions / iterSectionChanges, sessionLaws().iterSearch / iterList / iterChanges / iterBody, watches().iterList / iterChanges, boards().iterList.
Batch helpers split large inputs, de-duplicate in order and suffix the idempotency key per chunk (key-1, key-2).
An empty input sends nothing. Each helper has an
...Async form.
Webhooks
Deliveries use Standard Webhooks (webhook-id, webhook-timestamp, webhook-signature).
- Pass the raw request body, not re-serialised JSON.
headersis anyMap<String, ?>. Names are matched case-insensitively and values may be a string or a list.- The secret is the
whsec_base64 form or a plain string. An empty, blank orwhsec_-only secret, and invalid base64 afterwhsec_, throwIllegalArgumentException, so an unset environment variable can never verify a forged event. - Tolerance is 300 seconds either side of now. Use the longer overloads for another tolerance, several secrets (rotation) or the legacy
X-Vaquill-Signaturescheme (off by default, no replay protection). WebhookVerificationExceptionmeans do not trust the delivery.WebhookPayloadExceptionmeans the signature was valid but the body is not an event.
Versioning
The SDK follows semantic versioning, and the first release is planned as0.1.0.
The library targets Java 11 (--release 11).
Release workflow status
Release workflow status
Releases will be cut by pushing a
java-vX.Y.Z tag, which signs and publishes to Maven Central.
The signing and upload steps have not run yet, so the first release is the first time they are exercised.
