Internal HTTP client for the Layr8 cloud-node REST API.
Uses Req for HTTP requests. Authentication is via x-api-key header.
Not intended for direct use; accessed through Layr8.Credentials and
Layr8.Presentations.
Summary
Functions
Issues a GET request to path and returns the decoded response.
Creates a new REST client.
Issues a JSON POST request to path with body and returns the decoded response.
Types
@type t() :: %Layr8.REST{ api_key: String.t(), base_url: String.t(), timeout_ms: non_neg_integer() }
Functions
Issues a GET request to path and returns the decoded response.
Options
:timeout_ms— deadline on the response.0ornilleaves the call unbounded, which is the pre-existing behaviour.
Returns {:ok, map()} on success or {:error, term()} on failure.
Creates a new REST client.
Parameters
base_url— HTTP base URL of the cloud-node (e.g."https://node.example.com")api_key— API key for authentication
Options
:timeout_ms— default deadline on every call made through this client.0leaves them unbounded. SeeLayr8.Config.default_rest_timeout_ms/0for why the default is a deadline at all:Reqhas none of its own, so a node that accepted the connection and went quiet left every credential and presentation call hanging — neither resolving nor failing, and never letting the caller reach the point of deciding to retry.
Issues a JSON POST request to path with body and returns the decoded response.
Options
:timeout_ms— deadline on the response.0ornilleaves the call unbounded, which is the pre-existing behaviour.
Returns {:ok, map()} on success or {:error, term()} on failure.