Handle Tesla connections for ExBifrost.
Extends the stock openapi-generator connection with production defaults:
- Connection pooling via Finch (see
ExBifrost.Application) - Per-request timeouts
- Automatic retries with exponential backoff (idempotent requests only)
- Telemetry events via
Tesla.Middleware.Telemetry
Additional middleware and an alternative adapter can be set in the compile-time or runtime configuration:
config :tesla, ExBifrost.Connection,
base_url: "http://localhost:8080",
adapter: Tesla.Adapter.HackneyThe default base URL can also be set as:
config :ex_bifrost,
:base_url, "http://localhost:8080"
Summary
Functions
Returns the default adapter for this API.
Returns fully configured middleware for passing to Tesla.client/2.
Configure a ExBifrost client.
Forward requests to Tesla.
Types
@type options() :: [ base_url: String.t(), user_agent: String.t(), adapter: Tesla.Client.adapter(), timeout: non_neg_integer(), retry: keyword() | false, middleware: [Tesla.Client.middleware()], username: String.t() | nil, password: String.t() | nil, bearer_token: String.t() | nil ]
The list of options that can be passed to new/1.
base_url: Overrides the base URL on a per-client basis.user_agent: Overrides the User-Agent header.adapter: Overrides the Tesla adapter (defaults to Finch).timeout: Per-request timeout in milliseconds (default: 30_000).retry: Retry configuration keyword list, orfalseto disable retries.max_retries: Maximum number of retries (default: 3)delay: Initial backoff delay in milliseconds (default: 100)max_delay: Maximum backoff delay in milliseconds (default: 5_000)should_retry: Custom arity-3 retry predicate
middleware: Additional Tesla middleware (appended to the stack).username: A username for basic authentication.password: A password for basic authentication.bearer_token: A bearer token for bearer authentication.
Functions
Returns the default adapter for this API.
Defaults to Finch (pooled by ExBifrost.Application) and can be
overridden with:
config :tesla, ExBifrost.Connection, adapter: Tesla.Adapter.Hackney
@spec middleware(options()) :: [Tesla.Client.middleware()]
Returns fully configured middleware for passing to Tesla.client/2.
@spec new(options()) :: Tesla.Env.client()
Configure a ExBifrost client.
Parameters
options: an optional keyword list of ExBifrost.Connection.options.
Returns
Tesla.Env.client
@spec request(Tesla.Client.t(), [Tesla.option()]) :: Tesla.Env.result()
Forward requests to Tesla.