PaveDBClient. Client
(pavedb_client v0.1.0)
Copy Markdown
HTTP transport for PaveDB.
Summary
Functions
Builds a client struct. Prefer PaveDBClient.connect/2, which fills the
base URL in from PAVEDB_URL.
Sends a request with an empty body and decodes the response envelope.
Sends a request with body and decodes the response envelope.
Sends body as JSON and decodes the response envelope.
Sends a request and returns the undecoded response body on success.
Types
Functions
Builds a client struct. Prefer PaveDBClient.connect/2, which fills the
base URL in from PAVEDB_URL.
Takes :tenant, :token (or :api_key), :headers, :timeout,
:connect_timeout, and :transport. A base URL already ending in /v1 is
used as-is.
@spec request(t(), atom(), String.t(), keyword()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}
Sends a request with an empty body and decodes the response envelope.
Pass root: true for endpoints outside the /v1 API, such as /health.
@spec request(t(), atom(), String.t(), iodata(), keyword()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}
Sends a request with body and decodes the response envelope.
Takes :content_type and :root.
@spec request_json(t(), atom(), String.t(), map()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}
Sends body as JSON and decodes the response envelope.
@spec request_raw(t(), atom(), String.t(), keyword()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}
Sends a request and returns the undecoded response body on success.
Used for endpoints that answer with a raw body (for example chunk content)
instead of the usual JSON envelope. Non-2xx responses still decode into a
structured Error.