Documentation
¶
Overview ¶
Package pagination drives offset/limit iteration for list endpoints.
The Timestripe API exposes offset/limit pagination with a total count. Callers pass a Fetcher that performs a single page request; Fetch walks the result set up to Options.Limit (or until exhausted when --all is set).
Index ¶
Constants ¶
View Source
const DefaultLimit = 30
DefaultLimit is the number of items returned when --limit is not provided. Chosen to be small enough for quick inspection and large enough to be useful.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Envelope ¶
type Envelope[T any] struct { PageInfo PageInfo `json:"pageInfo" yaml:"pageInfo"` Items []T `json:"items" yaml:"items"` }
Envelope is the canonical JSON list response shape.
type Options ¶
type Options struct {
// Limit is the total number of items to return. Ignored when All is true.
Limit int
// Offset is the starting offset into the result set.
Offset int
// All iterates until the server reports no more results.
All bool
}
Options tunes the iteration. Zero values mean "use defaults".
type PageInfo ¶
type PageInfo struct {
Count int `json:"count" yaml:"count"`
HasMore bool `json:"hasMore" yaml:"hasMore"`
Next *string `json:"next,omitempty" yaml:"next,omitempty"`
Previous *string `json:"previous,omitempty" yaml:"previous,omitempty"`
}
PageInfo is the list metadata included in JSON/YAML output envelopes.
Click to show internal directories.
Click to hide internal directories.