Nombaone. Page
(Nomba One v0.1.0)
View Source
One page of a list result — the items on this page plus everything needed to keep going.
A Page is Enumerable: iterating it (with Enum, Stream, or a for
comprehension) walks every item across every following page, threading
cursors for you.
{:ok, page} = Nombaone.Customers.list(client, %{limit: 50})
# Just this page:
page.data
page.pagination.has_more
# Every customer, cursors handled for you (pages fetched lazily):
for customer <- page do
IO.puts(customer.email)
endA page fetch that fails mid-iteration raises the Nombaone error (streams
cannot carry an {:error, _}). Use next_page/1 when you want to handle that
as a tuple instead.
Summary
Functions
Whether another page exists beyond this one.
Fetch the next page — same filters, next cursor. Returns {:ok, page} or
{:error, error}. Raises ArgumentError if there is no next page (check
has_next_page?/1 first).
A lazy Stream over every item across this and all following pages. Iterating
the page directly does the same thing; this is the explicit form.
Types
@type t() :: %Nombaone.Page{ __caster__: term(), __client__: Nombaone.Client.t(), __spec__: map(), data: [term()], pagination: Nombaone.Pagination.t(), request_id: String.t() }
Functions
Whether another page exists beyond this one.
@spec next_page(t()) :: {:ok, t()} | {:error, Nombaone.Error.t()}
Fetch the next page — same filters, next cursor. Returns {:ok, page} or
{:error, error}. Raises ArgumentError if there is no next page (check
has_next_page?/1 first).
@spec stream(t()) :: Enumerable.t()
A lazy Stream over every item across this and all following pages. Iterating
the page directly does the same thing; this is the explicit form.