Skip to content

Conversation

@wuvictor-95
Copy link

No description provided.

Copy link
Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@wuvictor-95 wuvictor-95 marked this pull request as ready for review January 29, 2026 16:57
@wuvictor-95 wuvictor-95 force-pushed the 01-29-add_pagination_to_list_platform_internal_external_accounts branch from 49d8386 to d01f7d9 Compare January 29, 2026 17:00
@greptile-apps
Copy link

greptile-apps bot commented Jan 29, 2026

Greptile Overview

Greptile Summary

This PR adds cursor-based pagination support to the platform-level internal and external account listing endpoints (/platform/internal-accounts and /platform/external-accounts).

Changes made:

  • Added limit query parameter (default 20, max 100) to control page size
  • Added cursor query parameter for fetching subsequent pages
  • Added hasMore boolean field to response (now required) indicating if more results exist
  • Added nextCursor string field to response with the cursor for the next page
  • Added totalCount integer field to response showing total matching records

Implementation notes:

  • The pagination pattern matches the existing implementation used in customer-level account endpoints (/customers/internal-accounts, /customers/external-accounts) and other list endpoints like /customers and /transactions
  • The changes maintain backward compatibility - existing clients can continue to use the endpoints without pagination parameters and will receive the first page
  • Bundled OpenAPI files (openapi.yaml and mintlify/openapi.yaml) were correctly regenerated
  • Package manager configuration was updated to Yarn 4.5.0, with corresponding PnP loader files generated

Confidence Score: 5/5

  • This PR is safe to merge - it adds standard pagination to two endpoints with consistent implementation
  • The implementation follows the established pagination pattern used throughout the API, adds no breaking changes, and includes proper schema validation with correct defaults and constraints
  • No files require special attention

Important Files Changed

Filename Overview
openapi/paths/platform/platform_external_accounts.yaml Added pagination parameters (limit, cursor) and response fields (hasMore, nextCursor, totalCount) - correctly implemented
openapi/paths/platform/platform_internal_accounts.yaml Added pagination parameters (limit, cursor) and response fields (hasMore, nextCursor, totalCount) - correctly implemented
package.json Added packageManager field specifying yarn 4.5.0

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as Grid API
    participant DB as Database

    Note over Client,DB: Initial Request (First Page)
    Client->>API: GET /platform/internal-accounts?limit=20
    API->>DB: Query internal accounts (limit=20)
    DB-->>API: Return accounts + hasMore flag
    API-->>Client: Response {data: [...], hasMore: true, nextCursor: "abc123", totalCount: 45}

    Note over Client,DB: Subsequent Request (Next Page)
    Client->>API: GET /platform/internal-accounts?limit=20&cursor=abc123
    API->>DB: Query internal accounts from cursor (limit=20)
    DB-->>API: Return accounts + hasMore flag
    API-->>Client: Response {data: [...], hasMore: true, nextCursor: "def456", totalCount: 45}

    Note over Client,DB: Final Page
    Client->>API: GET /platform/internal-accounts?limit=20&cursor=def456
    API->>DB: Query internal accounts from cursor (limit=20)
    DB-->>API: Return remaining accounts
    API-->>Client: Response {data: [...], hasMore: false, totalCount: 45}

    Note over Client,DB: Same Pattern for External Accounts
    Client->>API: GET /platform/external-accounts?currency=USD&limit=10
    API->>DB: Query external accounts (filter: USD, limit=10)
    DB-->>API: Return accounts + hasMore flag
    API-->>Client: Response {data: [...], hasMore: true, nextCursor: "xyz789", totalCount: 25}
Loading

@greptile-apps
Copy link

greptile-apps bot commented Jan 29, 2026

Greptile Overview

Greptile Summary

Added cursor-based pagination to platform internal and external accounts list endpoints, matching the existing pagination pattern used across other list endpoints in the API.

Key changes:

  • Added limit (default 20, max 100) and cursor query parameters to both /platform/internal-accounts and /platform/external-accounts GET endpoints
  • Added hasMore (required boolean), nextCursor (optional string), and totalCount (optional integer) fields to response schemas
  • Updated bundled OpenAPI specs (openapi.yaml and mintlify/openapi.yaml) with these changes
  • Incidental fix: added explicit type: string to LIGHTNING accountType field (already present in source schemas)

Confidence Score: 5/5

  • This PR is safe to merge - implements standard pagination pattern with no breaking changes
  • The implementation follows the exact same pagination pattern already established across 10+ other list endpoints in the API (customers, internal accounts, external accounts, quotes, transactions, etc.). The changes are purely additive with sensible defaults, ensuring backward compatibility.
  • No files require special attention

Important Files Changed

Filename Overview
openapi/paths/platform/platform_internal_accounts.yaml Added cursor-based pagination with limit, cursor, hasMore, nextCursor, and totalCount fields - consistent with existing API patterns
openapi/paths/platform/platform_external_accounts.yaml Added cursor-based pagination with limit, cursor, hasMore, nextCursor, and totalCount fields - consistent with existing API patterns
openapi.yaml Bundled OpenAPI spec updated with pagination changes from source files, plus incidental fix adding type: string to LIGHTNING accountType
mintlify/openapi.yaml Copy of bundled OpenAPI spec for Mintlify documentation - identical changes to root openapi.yaml

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as Grid API
    participant DB as Database

    Note over Client,DB: Initial Request (First Page)
    Client->>API: GET /platform/internal-accounts?limit=20
    API->>DB: Query accounts (LIMIT 21)
    DB-->>API: Return up to 21 accounts
    API->>API: Check if hasMore (count > limit)
    API->>API: Generate nextCursor (if hasMore)
    API-->>Client: {data: [20 accounts], hasMore: true, nextCursor: "abc123", totalCount: 45}

    Note over Client,DB: Subsequent Request (Next Page)
    Client->>API: GET /platform/internal-accounts?limit=20&cursor=abc123
    API->>DB: Query accounts from cursor (LIMIT 21)
    DB-->>API: Return up to 21 accounts
    API->>API: Check if hasMore (count > limit)
    API->>API: Generate nextCursor (if hasMore)
    API-->>Client: {data: [20 accounts], hasMore: true, nextCursor: "def456", totalCount: 45}

    Note over Client,DB: Final Request (Last Page)
    Client->>API: GET /platform/internal-accounts?limit=20&cursor=def456
    API->>DB: Query accounts from cursor (LIMIT 21)
    DB-->>API: Return 5 accounts
    API->>API: Check if hasMore (count <= limit)
    API-->>Client: {data: [5 accounts], hasMore: false, totalCount: 45}
Loading

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.

2 participants