GoCardlessClient.Paginator (GoCardlessClient v2.0.0)

Copy Markdown View Source

Cursor-based pagination for GoCardlessClient list endpoints.

Returns a lazy Stream that automatically fetches additional pages as items are consumed. No extra memory is allocated until items are pulled.

Example

# Stream all paid-out payments lazily
GoCardlessClient.Resources.Payments.stream(client, %{status: "paid_out"})
|> Stream.each(&reconcile/1)
|> Stream.run()

# Collect all customers into a list
{:ok, customers} = GoCardlessClient.Paginator.collect(client, "/customers", %{}, "customers")

Summary

Functions

Eagerly collects all pages into a list.

Returns a lazy Stream over all pages of a GoCardlessClient list endpoint.

Types

page_item()

@type page_item() :: map()

Functions

collect(client, path, params, resource_key, opts \\ [])

Eagerly collects all pages into a list.

Returns {:ok, [item]} or {:error, reason} if any page fetch fails.

stream(client, path, params, resource_key, opts \\ [])

Returns a lazy Stream over all pages of a GoCardlessClient list endpoint.

  • client — a GoCardlessClient.Client struct
  • path — API path e.g. "/payments"
  • params — initial query params as a map
  • resource_key — JSON key holding the list e.g. "payments"
  • opts — per-request options (:idempotency_key, :request_id, etc.)