Skip to content

Commit

Permalink
fix(backend): Add createOrganizationEnabled param in User.update() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkl authored Dec 19, 2023
1 parent 85da539 commit e7e2a1e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .changeset/spotty-ravens-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@clerk/backend': minor
---

Add `createOrganizationEnabled` param in `@clerk/backend` method `User.updateUser()`
Example:
```typescript
import { createClerkClient } from '@clerk/backend';

const clerkClient = createClerkClient({...});
await clerkClient.users.updateUser('user_...', { createOrganizationEnabled: true })
```
1 change: 1 addition & 0 deletions packages/backend/src/api/endpoints/UserApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ interface UpdateUserParams extends UserMetadataParams {
backupCodes?: string[];
externalId?: string;
createdAt?: Date;
createOrganizationEnabled?: boolean;
}

type GetOrganizationMembershipListParams = ClerkPaginationRequest<{
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/api/resources/JSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export interface UserJSON extends ClerkResourceJSON {
created_at: number;
updated_at: number;
last_active_at: number | null;
create_organization_enabled: boolean;
}

export interface VerificationJSON extends ClerkResourceJSON {
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/api/resources/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class User {
readonly web3Wallets: Web3Wallet[] = [],
readonly externalAccounts: ExternalAccount[] = [],
readonly lastActiveAt: number | null,
readonly createOrganizationEnabled: boolean,
) {}

static fromJSON(data: UserJSON): User {
Expand Down Expand Up @@ -66,6 +67,7 @@ export class User {
(data.web3_wallets || []).map(x => Web3Wallet.fromJSON(x)),
(data.external_accounts || []).map((x: ExternalAccountJSON) => ExternalAccount.fromJSON(x)),
data.last_active_at,
data.create_organization_enabled,
);
}
}

0 comments on commit e7e2a1e

Please sign in to comment.