feat: add pagination control to home timeline methods#61
Open
the-vampiire wants to merge 1 commit intosteipete:mainfrom
Open
feat: add pagination control to home timeline methods#61the-vampiire wants to merge 1 commit intosteipete:mainfrom
the-vampiire wants to merge 1 commit intosteipete:mainfrom
Conversation
Adds `cursor` and `maxPages` options to `getHomeTimeline()` and `getHomeLatestTimeline()`, with `nextCursor` in the response. This enables: - Resumable pagination (start from a saved position) - Controlled page fetching (fetch N pages, get cursor for more) - Consistent API with other paginated methods Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
Adds
cursorandmaxPagesoptions togetHomeTimeline()andgetHomeLatestTimeline(), withnextCursorin the response.New options in
HomeTimelineFetchOptions:cursor?: string- Resume pagination from a saved positionmaxPages?: number- Limit number of pages fetched (returnsnextCursorif more available)Return value:
nextCursornow included inSearchResultwhen more pages are availableUse Cases
getRepliesPagedExample
Design Decision
This implementation uses an inline pagination loop rather than the existing
paginateCursor()utility. The reasons:count-based fetching ("fetch N tweets total") whilepaginateCursor()is designed for simpler "fetch all matching items" scenariosgetUserTweetsPaged(),getBookmarksPaged(), andgetLikesPaged()which all use inline loopsfetchWithRefresh()wrapper for handling 404s with query ID mismatches, whichpaginateCursor()doesn't supportChanges
src/lib/twitter-client-home.ts: Add cursor/maxPages/nextCursor supporttests/twitter-client.home-timeline.test.ts: Add 4 new pagination testsTesting
All existing tests pass, plus 4 new tests covering:
maxPagesoption respectedcursoroption for resumingnextCursorundefined when no more pagesgetHomeLatestTimelinetoo🤖 Generated with Claude Code