Skip to content

Implement pagination helper utilities for list endpoints in @astroid/client #99

Description

@Cjay-Cyber-2

Description — what to implement and the why/impact.

Listing resources such as agents, transactions, and budgets returns paginated datasets from the backend API. Developers and agents need ergonomic pagination helpers and async iterators to seamlessly consume multi-page results without manual cursor management.

Context & Requirements — background, constraints, design references, edge cases; grounded in the actual repo (real files, stack, conventions).

Provide helper utilities or async generators in @astroid/client that accept a list query function and iterate through cursors (cursor, limit, has_more) automatically, yielding individual items or pages as requested.

Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done".

  • Implement an async generator function for paginating resource lists.
  • Support standard cursor-based pagination parameters (cursor, limit).
  • Handle empty result sets and termination conditions correctly.
  • Add comprehensive unit tests mocking paginated API responses.

Implementation Guidance — likely files/modules to touch (use real paths from the repo context) and a suggested approach, without over-prescribing.

Check packages/client/src/ for existing query builders or response interfaces. Design the helper to be generic over item types and response DTOs.

Testing & Validation — how the contributor should prove it works (tests to add/run, manual checks, screenshots for UI).

Run pnpm test --filter @astroid/client and ensure all tests pass.

Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting; follow the repo's existing style and conventions.


Wave complexity: Medium

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions