refactor: remove duplicate TokenPaginationStrategy in favor of CursorPaginationStrategy#94
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TokenPaginationStrategywas a behavioral duplicate ofCursorPaginationStrategy: theirparse(...)bodies are line-for-line identical, and they differ only in the default query-parameter name (page_tokenvscursor). Because that name is already a constructor parameter onCursorPaginationStrategy,CursorPaginationStrategy(items, extractor, "page_token")reproduces the token strategy exactly.This removes the duplicate and keeps
CursorPaginationStrategyas canonical. The two pieces of unique test coverage from the token suite (thestreamAll()walk and base64-value URL-encoding throughRequestRebuilder) are migrated ontoCursorPaginationStrategy; 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