Zazu.Page (zazu v0.2.1)

Copy Markdown View Source

One page of a cursor-paginated list endpoint: {"data" => [...], "has_more" => bool, "next_cursor" => string | nil}.

The API caps page size at 100 records; :limit is validated against that cap before the request is made.

Summary

Functions

The API's hard page-size cap.

Fetches the following page as {:ok, page}, or returns nil when this is the last one.

Types

t()

@type t() :: %Zazu.Page{
  data: [map()],
  fetch: (String.t() -> {:ok, t()} | {:error, Exception.t()}),
  has_more: boolean(),
  next_cursor: String.t() | nil,
  response: Zazu.Response.t()
}

Functions

max_per_page()

@spec max_per_page() :: pos_integer()

The API's hard page-size cap.

next(page)

@spec next(t()) :: {:ok, t()} | {:error, Exception.t()} | nil

Fetches the following page as {:ok, page}, or returns nil when this is the last one.