Lazy snowflake-cursor walker behind every *_stream helper.
Discord list endpoints page by before/after snowflake ids rather than opaque
cursors. stream/2 calls fetch.(cursor) (cursor is nil for the first page,
then the next snowflake id), emits each item, and stops when a page is empty or
shorter than :limit.
A failed page fetch raises the %Noizu.Discord.Error{} (an enumerable cannot
return an error mid-stream); rescue at the enumeration site if desired.
Options
:direction—:after(default; next cursor = largest id on the page) or:before(next cursor = smallest id).:limit— page size requested; a shorter page ends the stream.:id_fun— extracts the snowflake from an item (default& &1["id"]).:start— initial cursor (defaultnil).
Summary
Functions
Snowflake ordering helper: compares ids numerically.
Functions
Snowflake ordering helper: compares ids numerically.
@spec stream( (String.t() | nil -> {:ok, list()} | {:error, Noizu.Discord.Error.t()}), keyword() ) :: Enumerable.t()