GoCardlessClient.Client (GoCardlessClient v2.0.0)

Copy Markdown View Source

GoCardlessClient API client struct. Build with new/1 or new!/1.

Quick start

client = GoCardlessClient.Client.new!(access_token: "tok", environment: :sandbox)
{:ok, cust} = GoCardlessClient.Resources.Customers.create(client, %{email: "a@b.com"})

Summary

Functions

Creates a client; returns {:ok, t()} or {:error, %NimbleOptions.ValidationError{}}.

Like new/1 but raises ArgumentError on bad options.

Returns the current rate-limit state observed from API responses.

Returns a new client with a different access token (per-merchant OAuth flows).

Types

t()

@type t() :: %GoCardlessClient.Client{config: GoCardlessClient.Config.t()}

Functions

new(opts \\ [])

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

Creates a client; returns {:ok, t()} or {:error, %NimbleOptions.ValidationError{}}.

new!(opts \\ [])

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

Like new/1 but raises ArgumentError on bad options.

rate_limit_state(client)

@spec rate_limit_state(t()) :: map()

Returns the current rate-limit state observed from API responses.

with_token(c, token)

@spec with_token(t(), String.t()) :: t()

Returns a new client with a different access token (per-merchant OAuth flows).