Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions .changeset/calm-brooms-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': minor
---

Added support for User `locale`
5 changes: 5 additions & 0 deletions packages/backend/src/api/endpoints/UserApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ type CreateUserParams = {
password?: string;
firstName?: string;
lastName?: string;
/** The locale of the user in BCP-47 format. */
locale?: string;
skipPasswordChecks?: boolean;
skipPasswordRequirement?: boolean;
skipLegalChecks?: boolean;
Expand Down Expand Up @@ -149,6 +151,9 @@ type UpdateUserParams = {
/** A custom timestamp denoting when the user accepted legal requirements, specified in RFC3339 format (e.g. 2012-10-20T07:15:20.902Z). */
legalAcceptedAt?: Date;

/** The locale of the user in BCP-47 format. */
locale?: string;

/** If true, the user can delete themselves with the Frontend API. */
deleteSelfEnabled?: boolean;

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 @@ -606,6 +606,7 @@ export interface UserJSON extends ClerkResourceJSON {
create_organizations_limit: number | null;
delete_self_enabled: boolean;
legal_accepted_at: number | null;
locale: string | null;
}

export interface VerificationJSON extends ClerkResourceJSON {
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/api/resources/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ export class User {
* The unix timestamp of when the user accepted the legal requirements. `null` if [**Require express consent to legal documents**](https://clerk.com/docs/guides/secure/legal-compliance) is not enabled.
*/
readonly legalAcceptedAt: number | null,

/**
* The locale of the user.
*/
readonly locale: string | null,
) {}

static fromJSON(data: UserJSON): User {
Expand Down Expand Up @@ -180,6 +185,7 @@ export class User {
data.create_organizations_limit,
data.delete_self_enabled,
data.legal_accepted_at,
data.locale,
);
res._raw = data;
return res;
Expand Down
Loading