Skip to content

Commit

Permalink
fix(backend): Add filter by status support for getInvitationList method
Browse files Browse the repository at this point in the history
fix(backend): Add filter by status support for getInvitationList method

fix(backend): Add JSdoc
  • Loading branch information
raptisj committed Jul 28, 2023
1 parent 0b9388c commit 876777c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sixty-eyes-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': minor
---

Add filter by status(pending, accepted, revoked) support for getInvitationList method
17 changes: 16 additions & 1 deletion packages/backend/src/api/endpoints/InvitationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Invitation[]>({
method: 'GET',
path: basePath,
queryParams: params,
});
}

Expand Down

0 comments on commit 876777c

Please sign in to comment.