OpenPayments.Types.Pagination (open_payments_elixir v1.0.0)

Copy Markdown View Source

Pagination query arguments shared by payment-list operations.

Optional first and last are integers from 1 through 100, following the pinned query parameters. At most one may be supplied, matching Node's forward/backward pagination union; this exclusivity is an SDK rule beyond the independent parameter schemas. Optional cursor is a nonempty UTF-8 string. All fields may be omitted; no page size or direction is defaulted.

Map input accepts only the string keys first, last and cursor. Numeric strings, floats, explicit null and unknown fields are invalid. Missing fields become nil and are omitted on export. Typed nil fields also mean omission. Wallet filters, credentials and resource-server URLs belong to the list operation separately.

Cursors are opaque and retain their exact spelling without UUID/URL/base64 checks, trimming, decoding or comparison with page metadata. Exports retain integer counts and raw cursor strings; they do not percent-encode a query. This type makes no requests and performs no automatic traversal.

Inspection exposes only counts. Explicit map/JSON exports include the cursor. Errors contain safe field paths without rejected values. Validate constructed or modified structs with validate/1; to_map/1 converts without validating.

Summary

Functions

Decodes strict pagination arguments without coercing values or applying defaults.

Exports present protocol arguments without validation or query encoding.

Revalidates typed pagination arguments, treating nil fields as omitted.

Types

t()

@type t() :: %OpenPayments.Types.Pagination{
  cursor: String.t() | nil,
  first: 1..100 | nil,
  last: 1..100 | nil
}

Functions

from_map(data)

@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}

Decodes strict pagination arguments without coercing values or applying defaults.

to_map(pagination)

@spec to_map(t()) :: map()

Exports present protocol arguments without validation or query encoding.

validate(pagination)

@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}

Revalidates typed pagination arguments, treating nil fields as omitted.