feat(organization): listUserInvitations adds the ability to list all invitations for a given user (#3121)

* feat(org): listUserInvitations

This PR introduces  in the org plugin.

* chore: lint
This commit is contained in:
Maxwell
2025-07-11 16:58:12 +10:00
committed by GitHub
parent c4c9530602
commit 3547c9d09a
5 changed files with 163 additions and 3 deletions

View File

@@ -560,7 +560,7 @@ await authClient.organization.getInvitation({
### List Invitations
To list all invitations you can use the `listInvitations` function provided by the client.
To list all invitations for a given organization you can use the `listInvitations` function provided by the client.
```ts title="auth-client.ts"
const invitations = await authClient.organization.listInvitations({
@@ -570,6 +570,30 @@ const invitations = await authClient.organization.listInvitations({
})
```
### List user invitations
To list all invitations for a given user you can use the `listUserInvitations` function provided by the client.
```ts title="auth-client.ts"
const invitations = await authClient.organization.listUserInvitations()
```
On the server, you can pass the user ID as a query parameter.
```ts title="api.ts"
const invitations = await auth.api.listUserInvitations({
query: {
email: "user@example.com"
}
})
```
<Callout type="warn">
The `email` query parameter is only available on the server to query for invitations for a specific user.
</Callout>
## Members
### Remove Member