DodoPayments.ReqClient (dodo_payments v0.1.0)

Copy Markdown View Source

First-class Req implementation of DodoPayments.ClientModule.

The state wraps a reusable, credential-free %Req.Request{}. Its plugins, adapter, Finch pool, and non-protected options are preserved. Dodo Payments credentials are resolved by the request engine and are never retained in this state.

Each callback invocation disables Req retries and redirects and performs one request. A final request step protects the absolute URL, method, body, authorization, response mode, and timeout after caller-provided request steps have run. Finite response limits are enforced while Finch streams chunks, before the complete body can be buffered. Response compression is disabled because Req's decompression step requires a fully buffered body. Caller-provided steps remain trusted application code. The internal :dodo_payments_protect step name is reserved and rejected when wrapping an existing request.

Wrapped state must also be credential-free and may not enable Req cache or AWS signing behavior. User-agent precedence is reusable Req configuration, then a request-local header, then the SDK default.

Summary

Functions

Wraps an existing credential-free Req request without rebuilding it.

Wraps an existing credential-free Req request or raises a configuration error.

Creates adapter state around a new Req request.

Creates adapter state around a new Req request or raises a configuration error.

Types

t()

@opaque t()

Functions

from_req(request)

@spec from_req(Req.Request.t()) ::
  {:ok, t()} | {:error, DodoPayments.Error.ConfigurationError.t()}

Wraps an existing credential-free Req request without rebuilding it.

from_req!(request)

@spec from_req!(Req.Request.t()) :: t()

Wraps an existing credential-free Req request or raises a configuration error.

new(opts \\ [])

@spec new(keyword()) ::
  {:ok, t()} | {:error, DodoPayments.Error.ConfigurationError.t()}

Creates adapter state around a new Req request.

new!(opts \\ [])

@spec new!(keyword()) :: t()

Creates adapter state around a new Req request or raises a configuration error.