# `OpenPayments.Types.PageInfo`
[🔗](https://github.com/interledger/open-payments-elixir/blob/v1.0.0/lib/open_payments/types/page_info.ex#L1)

Pagination metadata shared by incoming- and outgoing-payment lists.

Follows the pinned `page-info` schema: required boolean has_next_page and
has_previous_page, plus optional nonempty string start_cursor and end_cursor.
No additional fields are permitted. Missing cursors become nil and are omitted
on export; explicit JSON null and empty strings are invalid. Page flags are
never defaulted.

Cursors are opaque UTF-8 strings whose spelling is preserved. This codec does
not require UUIDs, URLs, a particular encoding, both cursors together or a
relationship between cursors and page flags. It does not fetch pages, validate
pagination request arguments, infer ordering or compare cursors with results.

Inspection exposes only the page flags. Explicit map/JSON exports include
cursors. Errors contain safe field paths without rejected values. Validate
modified structs with `validate/1`; `to_map/1` converts without validating.

# `t`

```elixir
@type t() :: %OpenPayments.Types.PageInfo{
  end_cursor: String.t() | nil,
  has_next_page: boolean(),
  has_previous_page: boolean(),
  start_cursor: String.t() | nil
}
```

# `from_map`

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

Decodes strict pagination metadata without supplying missing flags or cursors.

# `to_map`

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

Converts to protocol fields, including cursors, without validating.

# `validate`

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

Revalidates flags and cursors, treating nil optional cursors as omitted.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
