Pagination cursor helpers for Marqeta list endpoints.
Marqeta paginates with count (page size) and start_index (offset).
Responses include "is_more": true when further pages exist.
Example
{:ok, page} = Marqeta.Users.list(%{count: 10, start_index: 0})
if Marqeta.Pagination.has_more?(page) do
next = Marqeta.Pagination.next_page_params(page, %{count: 10, start_index: 0})
{:ok, page2} = Marqeta.Users.list(next)
end
Summary
Functions
Returns default pagination params %{count: 5, start_index: 0}.
Extracts the "data" list from a paginated response.
Returns true when the response signals there are more pages.
Returns params for the next page, or nil when no more pages exist.
Normalises params, enforcing the maximum allowed count and a default start_index.
Returns the record count from a paginated response.
Types
@type normalized_params() :: %{ :count => pos_integer(), :start_index => non_neg_integer(), optional(atom()) => term() }
Functions
@spec default_params() :: %{count: 5, start_index: 0}
Returns default pagination params %{count: 5, start_index: 0}.
Extracts the "data" list from a paginated response.
Returns true when the response signals there are more pages.
Returns params for the next page, or nil when no more pages exist.
Determines "more pages" via:
"is_more": truein the response (Marqeta's explicit signal).- Fallback: returned
countequals requestedcount(more may exist).
@spec normalize_params(map()) :: normalized_params()
Normalises params, enforcing the maximum allowed count and a default start_index.
Always returns a map containing at least :count and :start_index integer keys.
@spec total_count(page()) :: non_neg_integer()
Returns the record count from a paginated response.