Skip to content

fix(backend): BAPIClients list methods should return { data, totalCount }#2714

Merged
nikosdouvlis merged 8 commits into
mainfrom
sdk-1260-backend-paginated-return-value
Feb 5, 2024
Merged

fix(backend): BAPIClients list methods should return { data, totalCount }#2714
nikosdouvlis merged 8 commits into
mainfrom
sdk-1260-backend-paginated-return-value

Conversation

@dimkl

@dimkl dimkl commented Feb 2, 2024

Copy link
Copy Markdown
Contributor

Description

Make all listing API requests to return consistent { data: Resource[], totalCount: number }.

Support pagination request params { limit, offset } to:

  • sessions.getSessionList({ limit, offset })
  • clients.getClientList({ limit, offset })

Since the users.getUserList() does not return the total_count as a temporary solution that
method will perform 2 BAPI requests:

  1. retrieve the data
  2. retrieve the total count (invokes users.getCount() internally)

Fix using ClerkPaginationRequest type without passing a generic.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/backend
  • @clerk/chrome-extension
  • @clerk/clerk-js
  • @clerk/clerk-expo
  • @clerk/fastify
  • gatsby-plugin-clerk
  • @clerk/localizations
  • @clerk/nextjs
  • @clerk/clerk-react
  • @clerk/remix
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/themes
  • @clerk/types
  • build/tooling/chore

@dimkl dimkl requested a review from gkats February 2, 2024 13:33
@dimkl dimkl self-assigned this Feb 2, 2024
@changeset-bot

changeset-bot Bot commented Feb 2, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4439e5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/backend Major
@clerk/types Patch
@clerk/fastify Patch
gatsby-plugin-clerk Patch
@clerk/nextjs Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/clerk-js Patch
@clerk/clerk-expo Patch
@clerk/clerk-react Patch
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dimkl dimkl force-pushed the sdk-1260-backend-paginated-return-value branch from 3b9cc1a to fc802ca Compare February 2, 2024 13:46
@dimkl dimkl requested a review from nikosdouvlis February 2, 2024 13:51
@dimkl dimkl changed the title Sdk 1260 backend paginated return value fix(backend): BAPIClients list methods should return { data, totalCount } Feb 2, 2024
@dimkl dimkl force-pushed the sdk-1260-backend-paginated-return-value branch from 9497ad9 to e4439e5 Compare February 5, 2024 11:03
@nikosdouvlis nikosdouvlis merged commit 244de5e into main Feb 5, 2024
@nikosdouvlis nikosdouvlis deleted the sdk-1260-backend-paginated-return-value branch February 5, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants