Shared HTTP helpers for GoCardlessClient resource modules.
GoCardless uses only GET and POST — there is no PUT, PATCH, or DELETE
(except DELETE /customers/:id for GDPR erasure). All update operations
use POST /resource/:id and all action endpoints use
POST /resource/:id/actions/:name.
Summary
Functions
POST to an action endpoint: path/actions/name.
Encodes a map of params into a URL query string, dropping nil values.
DELETE a resource.
GET a single resource and unwrap its envelope.
GET a list resource; returns {:ok, %{items: [...], meta: {...}}}.
POST to create a resource, wrapping params in %{key => params}.
POST to update a resource (GoCardless uses POST, not PUT/PATCH, for updates).
Types
@type error_response() :: {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
@type list_response() :: {:ok, %{items: [map()], meta: map()}} | error_response()
@type response() :: {:ok, map() | list() | nil} | error_response()
Functions
@spec action( GoCardlessClient.Client.t(), String.t(), String.t(), String.t(), map(), keyword() ) :: response()
POST to an action endpoint: path/actions/name.
Wraps params in %{resource_key => params} as required by the GoCardless API.
The envelope key is the resource key (e.g. "billing_requests"), NOT "data".
Encodes a map of params into a URL query string, dropping nil values.
@spec delete(GoCardlessClient.Client.t(), String.t(), String.t(), keyword()) :: response()
DELETE a resource.
Only used for GDPR customer erasure (DELETE /customers/:id).
All other "deletions" in GoCardless are POST actions (cancel, disable, etc.).
@spec get(GoCardlessClient.Client.t(), String.t(), String.t(), keyword()) :: response()
GET a single resource and unwrap its envelope.
@spec list(GoCardlessClient.Client.t(), String.t(), String.t(), map(), keyword()) :: list_response()
GET a list resource; returns {:ok, %{items: [...], meta: {...}}}.
POST to create a resource, wrapping params in %{key => params}.
GoCardless wraps both creates and updates in the resource envelope key.
POST to update a resource (GoCardless uses POST, not PUT/PATCH, for updates).
Wraps params in %{key => params} exactly like post/5.