Repository navigation
fix: follow pagination in get_profiles, get_users, and get_user_apikeys - #16
Merged
Merged
Conversation
These methods returned only the API's first page (50 items by default) and dropped the `next` offset, so callers had no way to get the rest. They now follow `next` in pages of up to 200 and return every item; `limit` caps the total and `offset` starts from an earlier page. New `profiles_page` and `users_page` methods return a single `base.ListPage` (items plus `next`), and `iter_profiles` and `iter_users` stream items across pages. FakeTriage now pages the way the docs describe (default 50, max 200), and pages API key lists too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KBLBzm6b7WftoJvKs7VbJw
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.
get_profiles()andget_users()called_model(). That passes the response toconvert_to_model(), which turns{"data": [...], "next": ...}into a bare list and dropsnext. Triage paginates every collection: the default page is 50 and the max is 200, per https://tria.ge/docs/cloud-api/conventions/. As a result:offsetargument was unusable, because it needs thenextvalue of the previous page, which callers never saw.The slib.hatching Storm service (gormaniac/stormsvcs#14) currently works around this by calling the private
_request()itself.Changes
get_profiles,get_users, andget_user_apikeysnow follownextin pages of 200 and return every item.limitcaps the total;Noneor0returns all.offsetstarts from an earlier page._pages/_list/_iterhelpers the sample lists already use.profiles_pageandusers_pagereturn a single page as a newbase.ListPage, withdataplusnext.iter_profilesanditer_usersstream items across pages, matchingiter_samples/iter_search.ErrorResponseis returned, or raised withraise_on_api_err; theiter_*methods raise.Behavior change: calling
get_profiles()/get_users()with nolimitused to return the API's first page (50 items). It now returns everything. Code that relied on getting a single page can useprofiles_page/users_page.Testing
pytest tests: 45 passed, 4 skipped (the live tests; noHATCHING_TOKENwas available).limit.offset.iter_*methods.Generated by Claude Code