Skip to content

[codex] Paginate API-key and webhook lists#211

Open
pq198363-ops wants to merge 1 commit into
Agentpay-Org:mainfrom
pq198363-ops:bounty-146-list-pagination
Open

[codex] Paginate API-key and webhook lists#211
pq198363-ops wants to merge 1 commit into
Agentpay-Org:mainfrom
pq198363-ops:bounty-146-list-pagination

Conversation

@pq198363-ops

Copy link
Copy Markdown

Summary

Closes #146.

  • Add shared bounded limit/offset parsing for list endpoints.
  • Paginate GET /api/v1/api-keys with a total count while preserving prefix-only key list items.
  • Paginate GET /api/v1/webhooks with a total count while preserving webhook item shape.
  • Sort both lists by createdAt and then internal id for stable paging.
  • Document the pagination contract in the README and OpenAPI route summaries.

RED/GREEN

RED before implementation:

npm run build
NODE_ENV=test node --test dist/list-pagination.test.js

tests 2
pass 0
fail 2
failure: total was undefined on api-keys and webhooks list responses

GREEN after implementation:

npm run build
NODE_ENV=test node --test dist/list-pagination.test.js

tests 2
pass 2
fail 0

Verification

npx prettier --check README.md src/pagination.ts src/routes/apiKeys.ts src/routes/webhooks.ts src/routes/meta.ts src/list-pagination.test.ts
All matched files use Prettier code style!

npm run lint
eslint .

npm run build
NODE_ENV=test node --test dist/list-pagination.test.js
tests 2
pass 2
fail 0

NODE_ENV=test node --test dist/*.test.js dist/**/*.test.js
tests 91
pass 91
fail 0

git diff --check

Note: on Windows PowerShell I used the direct $env:NODE_ENV='test'; node --test ... equivalent after npm run build because the package npm test script uses POSIX-style NODE_ENV=test syntax.

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.

Add pagination and a total count to the api-keys and webhooks list endpoints

1 participant