Instrumented HTTP client wrapping Req.
Handles:
- JSON encoding/decoding
- RFC 7807 problem+json error body parsing
Tl-Trace-IdandTl-Should-Retryresponse header extraction- Telemetry events (
:start,:stop,:exception) - TLS 1.2+ enforcement via transport options
Summary
Functions
Build a Req.Request base client from a TruelayerClient.Config.
Execute an application/x-www-form-urlencoded POST request.
Execute a JSON request.
Functions
@spec build_client(TruelayerClient.Config.t()) :: Req.Request.t()
Build a Req.Request base client from a TruelayerClient.Config.
@spec form_post(Req.Request.t(), String.t(), map()) :: {:ok, map()} | {:error, TruelayerClient.Error.t()}
Execute an application/x-www-form-urlencoded POST request.
Used exclusively for OAuth2 token-endpoint calls.
@spec json_request(Req.Request.t(), TruelayerClient.Config.t(), keyword()) :: {:ok, term()} | {:error, TruelayerClient.Error.t()}
Execute a JSON request.
Returns {:ok, decoded_body} for 2xx responses or
{:error, %TruelayerClient.Error{}} for errors.