Paysafe.Client (Paysafe v1.0.0)

Copy Markdown View Source

Internal HTTP client for all Paysafe API calls.

Handles:

  • Base64 Basic Auth header construction
  • JSON serialisation/deserialisation
  • Exponential backoff retry on transient errors
  • Token-bucket rate limiting
  • Telemetry span emission
  • Unified {:ok, body} | {:error, %Error{}} return type

Summary

Functions

Perform a DELETE request.

Perform a GET request.

Perform a PATCH request with a JSON body.

Perform a POST request with a JSON body.

Perform a PUT request with a JSON body.

Types

method()

@type method() :: :get | :post | :put | :patch | :delete

result()

@type result() :: {:ok, map() | list()} | {:error, Paysafe.Error.t()}

Functions

delete(config, api, url, opts \\ [])

@spec delete(Paysafe.Config.t(), atom(), String.t(), keyword()) :: result()

Perform a DELETE request.

get(config, api, url, opts \\ [])

@spec get(Paysafe.Config.t(), atom(), String.t(), keyword()) :: result()

Perform a GET request.

patch(config, api, url, body, opts \\ [])

@spec patch(Paysafe.Config.t(), atom(), String.t(), map(), keyword()) :: result()

Perform a PATCH request with a JSON body.

post(config, api, url, body, opts \\ [])

@spec post(Paysafe.Config.t(), atom(), String.t(), map(), keyword()) :: result()

Perform a POST request with a JSON body.

put(config, api, url, body, opts \\ [])

@spec put(Paysafe.Config.t(), atom(), String.t(), map(), keyword()) :: result()

Perform a PUT request with a JSON body.