Skip to content

Pagination helpers for list endpoints#224

Merged
Baskarayelu merged 4 commits intoRemitwise-Org:mainfrom
shamoo53:Pagination-Helpers-for-List-Endpoints
Feb 25, 2026
Merged

Pagination helpers for list endpoints#224
Baskarayelu merged 4 commits intoRemitwise-Org:mainfrom
shamoo53:Pagination-Helpers-for-List-Endpoints

Conversation

@shamoo53
Copy link
Contributor

I have successfully implemented standardized pagination for the list endpoints as requested. Here's a summary of the changes made:

Implementation Summary

  1. Pagination Utility Functions
    Created lib/utils/pagination.ts with:
    PaginationParams interface for limit/cursor parameters
    PaginatedResult interface for standardized response shape
    validatePaginationParams() function to validate and sanitize inputs
    createPaginatedResponse() function to format responses
    paginateData() function for in-memory pagination
  2. API Endpoints
    Implemented three API endpoints with standardized pagination:
    /api/goals
    GET endpoint with limit/cursor pagination
    Response includes data array, nextCursor, and hasMore flag
    Mock data structure for goals with proper typing
    /api/bills
    GET endpoint with limit/cursor pagination
    Response includes data array, nextCursor, and hasMore flag
    Mock data structure for bills with proper typing
    /api/remittance/history
    GET endpoint with limit/cursor pagination
    Response includes data array, nextCursor, and hasMore flag
    Mock data structure for transactions with proper typing
  3. OpenAPI Documentation
    Created docs/openapi.json with comprehensive API specification:
    Detailed endpoints for goals, bills, and transaction history
    Parameter definitions for limit and cursor
    Response schemas for paginated results
    Proper error handling documentation
  4. README Documentation
    Updated README.md with:
    Explanation of pagination parameters
    Response shape documentation
    List of available endpoints
    Usage examples

Features Implemented
✅ Standardized Query Params: limit (default 20, max 100) and cursor (optional)
✅ Consistent Response Shape: { data: T[], nextCursor?: string, hasMore: boolean }
✅ Multiple Endpoints: /api/goals, /api/bills, /api/remittance/history
✅ OpenAPI Documentation: Comprehensive API specification
✅ README Documentation: Clear usage instructionsThe implementation follows cursor-based pagination which is efficient for large datasets and provides a consistent experience across all list endpoints. The solution is ready for integration with actual backend services or smart contracts in the future
Closes #185

@Baskarayelu
Copy link
Contributor

resolve the conflicts

@shamoo53
Copy link
Contributor Author

conflict resolved @Baskarayelu

@Baskarayelu
Copy link
Contributor

@shamoo53 please resolve the conflicts

@shamoo53
Copy link
Contributor Author

conflict resolved @Baskarayelu

@Baskarayelu Baskarayelu merged commit 137776d into Remitwise-Org:main Feb 25, 2026
1 of 2 checks passed
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.

Pagination Helpers for List Endpoints

2 participants