continuation-token-pagination-contract

Installation
SKILL.md

Page plus next-token, as one repository contract

The API answers with items and an opaque token for the next page. Everything downstream follows from stating that once, in the return type:

// adapted: parameter names generalized; signatures otherwise as written
fun getRelatedData(id: String): Flow<Resource<Pair<List<Track>, String?>>>
fun getRadioFromEndpoint(endpoint: Endpoint): Flow<Resource<Pair<List<Track>, String?>>>
  • Pair(items, token) — the page and the way to ask for the next one.
  • null token means end of pages. Nothing else may mean that.
  • The envelope (Resource, see repository-resource-flow-pattern) carries failure, so a failure is never expressed as an empty page or a null token.

The consumer stores exactly one thing — the token — and never a page number:

Installs
2
GitHub Stars
35
First Seen
6 days ago
continuation-token-pagination-contract — maxrave-dev/kotlin-footguns