diff --git a/.changeset/sixty-eyes-attend.md b/.changeset/sixty-eyes-attend.md new file mode 100644 index 0000000000..38fcdf5317 --- /dev/null +++ b/.changeset/sixty-eyes-attend.md @@ -0,0 +1,5 @@ +--- +'@clerk/backend': minor +--- + +Add filter by status(pending, accepted, revoked) support for getInvitationList method diff --git a/packages/backend/src/api/endpoints/InvitationApi.ts b/packages/backend/src/api/endpoints/InvitationApi.ts index 4192202aa4..25812cd5c1 100644 --- a/packages/backend/src/api/endpoints/InvitationApi.ts +++ b/packages/backend/src/api/endpoints/InvitationApi.ts @@ -10,11 +10,26 @@ type CreateParams = { publicMetadata?: UserPublicMetadata; }; +type GetInvitationListParams = { + /** + * Filters invitations based on their status(accepted, pending, revoked). + * + * @example + * get all revoked invitations + * + * import { invitations } from '@clerk/clerk-sdk-node'; + * await invitations.getInvitationList({ status: 'revoked }) + * + */ + status?: 'accepted' | 'pending' | 'revoked'; +}; + export class InvitationAPI extends AbstractAPI { - public async getInvitationList() { + public async getInvitationList(params: GetInvitationListParams = {}) { return this.request({ method: 'GET', path: basePath, + queryParams: params, }); }