Search documentation of polar_express

# PolarExpress.ListObject (polar_express v0.1.5)

Copy Markdown View Source

Represents a Polar paginated list response.

Polar API responses use `items` for the data array and `pagination` for metadata (total_count, max_page).

## Auto-paging

    client = PolarExpress.client("pk_test_...")
    {:ok, page} = PolarExpress.Client.request(client, :get, "/v1/customers/")

    page
    |> PolarExpress.ListObject.auto_paging_stream(client)
    |> Enum.take(50)

## Summary

### Types

t()

### Functions

auto_paging_stream(page, client, path, opts \\ [])

Returns a lazy `Stream` that yields every item across all pages.

## Types

# t()

    @type t() :: %PolarExpress.ListObject{
      items: [struct() | map()] | nil,
      pagination: map() | nil
    }

## Functions

# auto_paging_stream(page, client, path, opts \\ [])

    @spec auto_paging_stream(t(), PolarExpress.Client.t(), String.t(), keyword()) ::
      Enumerable.t()

Returns a lazy `Stream` that yields every item across all pages.

Uses `page` cursor pagination. The stream fetches the next page only when consumed (via `Enum` or `Stream` functions).