Builds lazy Streams over paginated list endpoints so callers can
Enum.take/2, pipe into Enum.reduce/3, etc. without manually tracking
page cursors.
This isn't tied to any one API family's pagination shape — every
list/stream pair in this package is built by supplying a fetch_page
function of type (cursor :: term()) -> {:ok, items :: [term()], next_cursor :: term() | nil} | {:error, Exception.t()}.
Summary
Functions
Returns a Stream that lazily fetches successive pages via fetch_page,
starting from initial_cursor (typically nil), and yields items one at
a time. If a page fetch fails, the exception is raised into the stream
consumer (mirroring Enum's convention of raising rather than smuggling
{:error, _} tuples through a lazy enumerable).
Types
@type fetch_page() :: (term() -> {:ok, [term()], term() | nil} | {:error, Exception.t()})
Functions
@spec stream(term(), fetch_page()) :: Enumerable.t()
Returns a Stream that lazily fetches successive pages via fetch_page,
starting from initial_cursor (typically nil), and yields items one at
a time. If a page fetch fails, the exception is raised into the stream
consumer (mirroring Enum's convention of raising rather than smuggling
{:error, _} tuples through a lazy enumerable).