Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): Add createOrganizationEnabled param in User.update() #2432

Merged
merged 1 commit into from
Dec 21, 2023
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
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 @@ -75,6 +75,7 @@ interface UpdateUserParams extends UserMetadataParams {
backupCodes?: string[];
externalId?: string;
createdAt?: Date;
createOrganizationEnabled?: boolean;
}

type GetOrganizationMembershipListParams = {
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 @@ -287,6 +287,7 @@ export interface UserJSON extends ClerkResourceJSON {
unsafe_metadata: UserUnsafeMetadata;
created_at: number;
updated_at: number;
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 @@ -38,6 +38,7 @@ export class User {
readonly phoneNumbers: PhoneNumber[] = [],
readonly web3Wallets: Web3Wallet[] = [],
readonly externalAccounts: ExternalAccount[] = [],
readonly createOrganizationEnabled: boolean,
) {}

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