Skip to content

refactor: remove duplicate TokenPaginationStrategy in favor of CursorPaginationStrategy#94

Merged
OmarAlJarrah merged 2 commits into
mainfrom
refactor/remove-duplicate-token-pagination
Jun 16, 2026
Merged

refactor: remove duplicate TokenPaginationStrategy in favor of CursorPaginationStrategy#94
OmarAlJarrah merged 2 commits into
mainfrom
refactor/remove-duplicate-token-pagination

Conversation

@OmarAlJarrah

Copy link
Copy Markdown
Member

Summary

TokenPaginationStrategy was a behavioral duplicate of CursorPaginationStrategy: their parse(...) bodies are line-for-line identical, and they differ only in the default query-parameter name (page_token vs cursor). Because that name is already a constructor parameter on CursorPaginationStrategy, CursorPaginationStrategy(items, extractor, "page_token") reproduces the token strategy exactly.

This removes the duplicate and keeps CursorPaginationStrategy as canonical. The two pieces of unique test coverage from the token suite (the streamAll() walk and base64-value URL-encoding through RequestRebuilder) are migrated onto CursorPaginationStrategy; the README, architecture, and implementation-plan docs are updated to list the shipped strategies.

Removing a public class is a binary-incompatible change, appropriate at 0.0.1-alpha; the API snapshot is regenerated to reflect the removal.

Closes #39

TokenPaginationStrategy was behaviorally identical to
CursorPaginationStrategy: same constructor shape, same parse() logic,
differing only in identifier naming and a default query-param value
("page_token" vs "cursor"). Since CursorPaginationStrategy already
exposes an overridable query-param name, token-style APIs
(next_page_token, pageToken, etc.) are fully served by constructing it
with the desired parameter name.

Remove the redundant type and migrate the two test cases that exercised
unique behavior (streamAll() equivalence and base64 value URL-encoding
through RequestRebuilder) onto CursorPaginationStrategy, preserving
coverage. Regenerate the sdk-core API snapshot for the net surface
reduction and update the docs that enumerated the shipped strategies.
The URL-encoding test also asserted the custom page_token query-param
path, so a single case guarded two independent properties. Split the
param-name assertion into a dedicated test and narrow the encoding test
to the default cursor param. Move the token-style guidance out of the
package-map table cells into surrounding prose in the README and
architecture docs.
@OmarAlJarrah OmarAlJarrah merged commit 752c05b into main Jun 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove TokenPaginationStrategy (duplicate of CursorPaginationStrategy)

1 participant