GoCardlessClient.Config (GoCardlessClient v2.0.0)

Copy Markdown View Source

Validated configuration for the GoCardlessClient SDK.

Set globally in config.exs or override per-call:

config :gocardless_client,
  access_token: System.get_env("GOCARDLESS_ACCESS_TOKEN"),
  environment: :live

client = GoCardlessClient.Client.new!(access_token: "token")

Summary

Functions

Returns the base API URL for the given environment.

Builds and validates a config map, merging app config with overrides.

Like new/1 but raises ArgumentError on invalid config.

Returns the NimbleOptions validation schema.

Types

t()

@type t() :: %{
  access_token: String.t(),
  environment: :sandbox | :live,
  api_version: String.t(),
  timeout: pos_integer(),
  max_retries: non_neg_integer(),
  base_backoff_ms: pos_integer(),
  max_backoff_ms: pos_integer(),
  pool_size: pos_integer(),
  telemetry_prefix: [atom()],
  finch_name: atom()
}

Functions

base_url(arg1)

@spec base_url(t()) :: String.t()

Returns the base API URL for the given environment.

new(overrides \\ [])

@spec new(keyword()) :: {:ok, t()} | {:error, NimbleOptions.ValidationError.t()}

Builds and validates a config map, merging app config with overrides.

new!(overrides \\ [])

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

Like new/1 but raises ArgumentError on invalid config.

schema()

@spec schema() :: NimbleOptions.t()

Returns the NimbleOptions validation schema.