Unleash. Client behaviour
(Unleash v5.1.2)
View Source
HTTP Client responsible for communicating with the Unleash API Server.
Summary
Types
Type representing the result of attempting to fetch features from the Unleash API.
A JSON-serialisable payload POSTed to the Unleash API (register/metrics).
Result of a register/metrics POST to the Unleash API.
Functions
Fetches features from the Unleash API, sending etag for HTTP caching. See features_result/0.
Sends a metrics bucket to the Unleash API.
Registers the given client payload with the Unleash API.
Registers this client instance with the Unleash API, advertising its configured strategies.
Types
@type features_result() :: {String.t(), Unleash.Features.t()} | {nil, atom() | String.t()} | :cached
Type representing the result of attempting to fetch features from the Unleash API.
It can be:
{etag, features}when fetched fresh features from the API and correspondent new HTTP etag.{nil, reason}in case of errors.:cachedin case of HTTP-level caching
@type payload() :: map()
A JSON-serialisable payload POSTed to the Unleash API (register/metrics).
@type post_result() :: {:ok, Req.Response.t()} | {:error, atom() | String.t()}
Result of a register/metrics POST to the Unleash API.
Callbacks
@callback features(String.t()) :: features_result()
@callback metrics(payload()) :: post_result()
@callback register_client() :: post_result()
Functions
@spec features(String.t() | nil) :: features_result()
Fetches features from the Unleash API, sending etag for HTTP caching. See features_result/0.
@spec metrics(payload()) :: post_result()
Sends a metrics bucket to the Unleash API.
@spec register(payload()) :: post_result()
Registers the given client payload with the Unleash API.
@spec register_client() :: post_result()
Registers this client instance with the Unleash API, advertising its configured strategies.