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
createdtimestamp (newest first, like Stripe) starting_after: Returns items after the specified IDending_before: Returns items before the specified ID- If both provided,
ending_beforetakes precedence has_more: true if there are more results beyond this page
Summary
Functions
Paginates a list of items using Stripe's pagination parameters.
Types
Functions
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")