Skip to content

refactor(api-keys): extract shared offset-pagination helper - #410

Merged
mikewheeleer merged 1 commit into
Agentpay-Org:mainfrom
thlpkee20-wq:feature/api-keys-01-helper
Jul 28, 2026
Merged

refactor(api-keys): extract shared offset-pagination helper#410
mikewheeleer merged 1 commit into
Agentpay-Org:mainfrom
thlpkee20-wq:feature/api-keys-01-helper

Conversation

@thlpkee20-wq

Copy link
Copy Markdown
Contributor

Closes #386

GET /api/v1/api-keys inlined the same limit/offset parsing and slicing
preamble that's duplicated in the webhooks list handler. Extracted it into
applyOffsetPage() in src/listPagination.ts as a single reusable entry
point consumed by the api-keys handler. Pure refactor — same defaults
(limit defaults to the full result set, offset defaults to 0), same
response shape ({ items, total }).

Test plan

  • npm run build
  • npm run lint
  • npm test — targeted run of list-pagination.test.js,
    apikey-recognition.test.js, apikeys-webhooks.test.js,
    routes/operational.test.js: 29/29 passing, no behavior change.

The GET /api/v1/api-keys handler inlined the same limit/offset parsing
and slicing preamble duplicated in the webhooks list handler. Extracted
it into applyOffsetPage() in src/listPagination.ts as a single reusable
entry point; behavior is unchanged (same defaults, same response shape).
@mikewheeleer

Copy link
Copy Markdown
Contributor

great job @thlpkee20-wq, lands the requirement cleanly. merging ✅

@mikewheeleer
mikewheeleer merged commit 5bb2456 into Agentpay-Org:main Jul 28, 2026
1 check 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.

Extract the shared api-keys handler validation into a reusable helper

2 participants