Boop.Client (BoopEx v1.0.0)

Copy Markdown View Source

The HTTP layer, built on Req. You normally call Boop.send/2 instead.

Retries network errors and 5xx responses twice with a short jittered backoff; never retries 4xx. Every request has a timeout. Passes config.req_options through to Req.new/1, which is how tests plug in a stub (plug: {Req.Test, Boop}).

Summary

Functions

Whether GET /health answers {"status": "ok"}.

POSTs an event. Returns {:ok, %{id, created_at}} or {:error, %Boop.Error{}}.

Functions

healthy?(config)

@spec healthy?(Boop.Config.t()) :: boolean()

Whether GET /health answers {"status": "ok"}.

post_event(event, config)

@spec post_event(Boop.Event.t(), Boop.Config.t()) ::
  {:ok, %{id: String.t(), created_at: DateTime.t()}} | {:error, Boop.Error.t()}

POSTs an event. Returns {:ok, %{id, created_at}} or {:error, %Boop.Error{}}.