Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nasty-insects-follow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': patch
---

feat: add `orderBy` argument to `getInvitationList` to control sorting (supports leading '+' for ascending and '-' for descending)
21 changes: 21 additions & 0 deletions packages/backend/src/api/endpoints/InvitationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { PaginatedResourceResponse } from '../resources/Deserializer';
import type { InvitationStatus } from '../resources/Enums';
import type { Invitation } from '../resources/Invitation';
import { AbstractAPI } from './AbstractApi';
import type { WithSign } from './util-types';

const basePath = '/invitations';

Expand All @@ -23,6 +24,26 @@ type CreateParams = {
type CreateBulkParams = Array<CreateParams>;

type GetInvitationListParams = ClerkPaginationRequest<{
/**
* Orders the returned invitations by a specific field and direction.
*
* Use a leading '-' for descending order, or no sign/'+' for ascending.
*
* Supported fields:
* - 'created_at' — when the invitation was created
* - 'email_address' — recipient email address
* - 'expires_at' — when the invitation expires
*
* @example
* ```ts
* // Newest first
* await clerkClient.invitations.getInvitationList({ orderBy: '-created_at' });
*
* // Alphabetical by email
* await clerkClient.invitations.getInvitationList({ orderBy: 'email_address' });
* ```
*/
orderBy?: WithSign<'created_at' | 'email_address' | 'expires_at'>;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
/**
* Filters invitations based on their status.
*
Expand Down
Loading