# `Noizu.WhatsApp.Pagination`
[🔗](https://github.com/noizu-labs-sdks/elixir-whatsapp/blob/v0.1.0/lib/noizu/whatsapp/pagination.ex#L1)

Lazy cursor walker behind every `*_stream` helper.

Graph list endpoints (e.g. WABA `message_templates`) page by opaque cursor
(`paging.cursors.after` in the response). `stream/2` calls `fetch.(cursor)`
(`cursor` is `nil` for the first page, then the `after` cursor), emits the
page's `data` items, and stops when there is no `after` cursor.

A failed page fetch **raises** the `%Noizu.WhatsApp.Error{}`; rescue at the
enumeration site if desired.

## Options

  * `:data_key` — the list key in the page (default `"data"`).
  * `:start` — initial cursor (default `nil`).

# `stream`

```elixir
@spec stream(
  (String.t() | nil -&gt; {:ok, map()} | {:error, Noizu.WhatsApp.Error.t()}),
  keyword()
) ::
  Enumerable.t()
```

---

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