Low-level HTTP transport for the Weavr client.
This module wraps Erlang's built-in :httpc so that weavr ships
with zero runtime dependencies. It is responsible for:
- building request URLs against a configured base URL
- serializing/deserializing JSON bodies
- attaching the
api-keyheader (andauth_token/Authorizationheader, supplied byWeavr.Client) - retrying idempotent requests on transient failures with exponential backoff and jitter
- emitting
:telemetryevents around every request - normalizing every outcome into
{:ok, status, headers, body}or{:error, Weavr.Error.t()}
This module is intentionally unaware of Weavr resources (accounts, cards, identities, ...). Resource modules call into this layer; this layer never calls back out to them.
Summary
Functions
Performs an HTTP request and returns a normalized result.
Types
@type method() :: :get | :post | :put | :patch | :delete
@type result() :: {:ok, pos_integer(), headers(), term()} | {:error, Weavr.Error.t()}
Functions
Performs an HTTP request and returns a normalized result.
Options
:base_url(required) - e.g."https://sandbox.weavr.io/multi":method(required) - one of[:get, :post, :put, :patch, :delete]:path(required) - e.g."/bulks/123"(joined onto:base_url):headers- additional headers, merged with internally-added ones:query- a map or keyword list of query parameters:body- a term to be JSON-encoded as the request body:idempotency_key- sent as theidempotency-refheader onPOST/PATCHrequests that support it:max_retries- defaults to2:connect_timeout- milliseconds, defaults to5000:recv_timeout- milliseconds, defaults to30000:telemetry_metadata- extra metadata merged into emitted telemetry events