ExShopifyApp.HTTP (ex_shopify_app v1.2.0)

Shared helpers for handling Tesla responses across the library's HTTP clients.

Summary

Functions

Unwraps a Tesla.Env.result() against an expected success status.

Functions

unwrap_response(result, status \\ 200, fun)

@spec unwrap_response(Tesla.Env.result(), pos_integer(), (Tesla.Env.t() -> result)) ::
  result
when result: {:ok, term()} | {:error, term()}

Unwraps a Tesla.Env.result() against an expected success status.

On the expected success status (default 200), fun is applied to the Tesla.Env and its result is returned — fun decides the final {:ok, term} | {:error, term}. Any other status collapses to {:error, %Tesla.Env{}}, and a transport error to {:error, reason}.