# `PaperTiger.List`
[🔗](https://github.com/EnaiaInc/paper_tiger/blob/v1.2.1/lib/paper_tiger/list.ex#L1)

Handles Stripe-style pagination for list endpoints.

Stripe uses cursor-based pagination with `starting_after`, `ending_before`, and `limit`.

## Examples

    # First page (default limit: 10)
    {:ok, page1} = Stripe.Customer.list()
    assert length(page1.data) == 10
    assert page1.has_more == true

    # Next page using cursor
    last_id = List.last(page1.data).id
    {:ok, page2} = Stripe.Customer.list(starting_after: last_id)

## Pagination Behavior

- Items are sorted by `created` timestamp (newest first, like Stripe)
- `starting_after`: Returns items after the specified ID
- `ending_before`: Returns items before the specified ID
- If both provided, `ending_before` takes precedence
- `has_more`: true if there are more results beyond this page

# `t`

```elixir
@type t() :: %PaperTiger.List{
  data: [map()],
  has_more: boolean(),
  object: String.t(),
  url: String.t()
}
```

# `paginate`

```elixir
@spec paginate([map()], keyword() | map()) :: t()
```

Paginates a list of items using Stripe's pagination parameters.

## Options

- `:limit` - Number of items to return (default: 10, max: 100)
- `:starting_after` - Return items after this ID
- `:ending_before` - Return items before this ID
- `:url` - The endpoint URL (for the response)

## Examples

    items = [...list of structs with .id and .created...]
    PaperTiger.List.paginate(items, limit: 20, url: "/v1/customers")

---

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