diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 378ac6b8..ed25425b 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: bfe29c99-6e67-43fe-b928-64d6a5ed6aa8 management: - docChecksum: 988da0b376f34c1dad41f86578b90dd5 + docChecksum: 3dfefff9a37b855f39ffa94246e8bc7b docVersion: "2025-03-12" - speakeasyVersion: 1.555.0 - generationVersion: 2.618.0 - releaseVersion: 3.0.2 - configChecksum: bac9e9ccd199045c7c1bdc55ea1c3795 + speakeasyVersion: 1.558.0 + generationVersion: 2.623.2 + releaseVersion: 3.0.3 + configChecksum: a1fc8a1a970474b0e9bd06b2727c69c6 repoURL: https://github.com/clerk/clerk-sdk-python.git installationURL: https://github.com/clerk/clerk-sdk-python.git published: true @@ -15,7 +15,7 @@ features: additionalDependencies: 1.0.0 additionalProperties: 1.0.1 constsAndDefaults: 1.0.5 - core: 5.19.1 + core: 5.19.2 customCodeRegions: 0.1.1 defaultEnabledRetries: 0.2.0 deprecations: 3.0.2 @@ -1153,7 +1153,7 @@ examples: path: user_id: "usr_test123" requestBody: - multipart/form-data: {"file": {"": ""}} + multipart/form-data: {"file": "x-file: example.file"} responses: "200": application/json: {"id": "user_id_123", "object": "user", "external_id": "external_user_id_123", "primary_email_address_id": "email_id_123", "primary_phone_number_id": "phone_id_123", "primary_web3_wallet_id": "wallet_id_123", "username": "john_doe", "first_name": "John", "last_name": "Doe", "image_url": "https://example.com/new-profile.jpg", "has_image": true, "public_metadata": {"role": "admin"}, "private_metadata": {"ssn": "123-45-6789"}, "unsafe_metadata": {"theme": "dark"}, "email_addresses": [{"id": "email_id_123", "object": "email_address", "email_address": "john.doe@example.com", "reserved": false, "verification": {"status": "verified", "strategy": "ticket", "attempts": null, "expire_at": null, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1609459200, "updated_at": 1609459200}], "phone_numbers": [{"id": "phone_id_123", "object": "phone_number", "phone_number": "+12345678901", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 2, "expire_at": 1622852400, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_id_123"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1609459200, "updated_at": 1609459200}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": null, "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{"object": "facebook_account", "id": "ext_account_id_123", "provider": "Facebook", "identification_id": "", "provider_user_id": "", "approved_scopes": "", "email_address": "Evalyn13@hotmail.com", "first_name": "Jewel", "last_name": "Hackett", "image_url": "https://rare-iridescence.name", "username": "Hollis45", "public_metadata": {"key": ""}, "label": "", "created_at": 947362, "updated_at": 25796, "verification": {"status": "verified", "strategy": "oauth_google", "external_verification_redirect_url": "https://oauth.google.com/verify", "error": null, "expire_at": 1615462399, "attempts": 1, "verified_at_client": ""}, "user_id": "user_id_at_provider"}], "saml_accounts": [{"id": "saml_account_id_123", "object": "saml_account", "provider": "SAML Provider", "active": true, "email_address": "user@example.com", "first_name": "John", "last_name": "Doe", "provider_user_id": "prov_user_id_123", "public_metadata": {"department": "IT"}, "verification": {"status": "verified", "strategy": "saml", "external_verification_redirect_url": "https://example.com/saml_callback", "error": null, "expire_at": 1622852400, "attempts": null, "verified_at_client": null}, "saml_connection": {"id": "sc_1234567890", "name": "My Company SAML Config", "domain": "mycompany.com", "active": true, "provider": "saml_custom", "sync_user_attributes": true, "allow_subdomains": false, "allow_idp_initiated": true, "disable_additional_identifications": false, "created_at": 1614768000, "updated_at": 1622540800}}], "last_sign_in_at": 1622852400, "banned": false, "locked": false, "lockout_expires_in_seconds": null, "verification_attempts_remaining": 5, "updated_at": 1622852400, "created_at": 1609459200, "delete_self_enabled": true, "create_organization_enabled": true, "create_organizations_limit": 830110, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} @@ -1782,7 +1782,7 @@ examples: path: organization_id: "org_12345" requestBody: - multipart/form-data: {"uploader_user_id": "user_67890", "file": {"": ""}} + multipart/form-data: {"uploader_user_id": "user_67890", "file": "path/to/your/logo.png"} responses: "200": application/json: {"object": "organization", "id": "org_123", "name": "Acme Corp", "slug": "acme-corp", "members_count": 150, "missing_member_with_elevated_permissions": false, "pending_invitations_count": 968142, "max_allowed_memberships": 300, "admin_delete_enabled": true, "public_metadata": {"public_info": "Info visible to everyone"}, "private_metadata": {"internal_use_only": "Sensitive data"}, "created_by": "user_123456", "created_at": 1625078400, "updated_at": 1625164800, "image_url": "https://example.com/image_url.png", "has_image": true} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index afa090a9..04a83c00 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -17,7 +17,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false python: - version: 3.0.2 + version: 3.0.3 additionalDependencies: dev: pytest: ^8.3.3 @@ -27,6 +27,7 @@ python: author: Clerk authors: - Clerk + baseErrorName: ClerkError clientServerStatusCodesAsErrors: true defaultErrorName: SDKError description: Python Client SDK for clerk.dev diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 0cd7b65c..fc2b0bab 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.555.0 +speakeasyVersion: 1.558.0 sources: clerk-openapi: sourceNamespace: clerk-openapi - sourceRevisionDigest: sha256:4cbf4283ce2a07c1f31443166a6c78d5c4c022c39d86870460af75f6c7f1aa18 - sourceBlobDigest: sha256:a82c310fc15cfea1ba234d207461311ad01e41fba0c5b4acb306797703c6de31 + sourceRevisionDigest: sha256:3288eba09b33528d64d74299415d843a118513d034d93d468cbe9ec68ca2bb7e + sourceBlobDigest: sha256:595a7d4c019d1d3c567ca7c4ceaffa57bb5306f217b12a75df160fb107e21e47 tags: - latest - - speakeasy-sdk-regen-1748970067 + - speakeasy-sdk-regen-1749494521 - "2025-03-12" targets: clerk-sdk-python: source: clerk-openapi sourceNamespace: clerk-openapi - sourceRevisionDigest: sha256:4cbf4283ce2a07c1f31443166a6c78d5c4c022c39d86870460af75f6c7f1aa18 - sourceBlobDigest: sha256:a82c310fc15cfea1ba234d207461311ad01e41fba0c5b4acb306797703c6de31 + sourceRevisionDigest: sha256:3288eba09b33528d64d74299415d843a118513d034d93d468cbe9ec68ca2bb7e + sourceBlobDigest: sha256:595a7d4c019d1d3c567ca7c4ceaffa57bb5306f217b12a75df160fb107e21e47 codeSamplesNamespace: clerk-openapi-python-code-samples - codeSamplesRevisionDigest: sha256:20e4f2303a68edd90192b676c7354339b7a18b5dfd52f2ed366fafa27b47ad73 + codeSamplesRevisionDigest: sha256:32d52dd50c58576c0c38393f9db2ce25e4027e95a5e8ea017aa0a49346721cb6 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -25,6 +25,7 @@ workflow: - location: https://raw.githubusercontent.com/clerk/openapi-specs/refs/heads/main/bapi/2025-03-12.yml overlays: - location: ./examples.yaml + - location: ./fixes.yaml - location: https://raw.githubusercontent.com/clerk/openapi-specs/refs/heads/main/.speakeasy/bapi/fixes.yml registry: location: registry.speakeasyapi.dev/clerk/clerk/clerk-openapi diff --git a/README.md b/README.md index 5b6d6d7d..962ac895 100644 --- a/README.md +++ b/README.md @@ -465,7 +465,6 @@ with Clerk( res = clerk.users.set_profile_image(user_id="usr_test123", file={ "file_name": "example.file", "content": open("example.file", "rb"), - "content_type": "", }) assert res is not None diff --git a/RELEASES.md b/RELEASES.md index 51e6a8df..dd7a2f26 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -338,4 +338,14 @@ Based on: ### Generated - [python v3.0.2] . ### Releases -- [PyPI v3.0.2] https://pypi.org/project/clerk-backend-api/3.0.2 - . \ No newline at end of file +- [PyPI v3.0.2] https://pypi.org/project/clerk-backend-api/3.0.2 - . + +## 2025-06-09 18:41:45 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.558.0 (2.623.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v3.0.3] . +### Releases +- [PyPI v3.0.3] https://pypi.org/project/clerk-backend-api/3.0.3 - . \ No newline at end of file diff --git a/docs/sdks/actortokens/README.md b/docs/sdks/actortokens/README.md index 9aac416c..70c4dcb0 100644 --- a/docs/sdks/actortokens/README.md +++ b/docs/sdks/actortokens/README.md @@ -28,9 +28,6 @@ with Clerk( user_id="user_1a2b3c", actor=clerk_backend_api.CreateActorTokenActor( sub="user_2OEpKhcCN1Lat9NQ0G6puh7q5Rb", - **{ - "sub": "user_2OEpKhcCN1Lat9NQ0G6puh7q5Rb", - }, ), )) diff --git a/docs/sdks/allowlistidentifiers/README.md b/docs/sdks/allowlistidentifiers/README.md index c01e49e2..04c6dab2 100644 --- a/docs/sdks/allowlistidentifiers/README.md +++ b/docs/sdks/allowlistidentifiers/README.md @@ -23,7 +23,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.allowlist_identifiers.list(paginated=False) + res = clerk.allowlist_identifiers.list(paginated=False, limit=20, offset=10) assert res is not None @@ -68,6 +68,7 @@ with Clerk( res = clerk.allowlist_identifiers.create(request={ "identifier": "user@example.com", + "notify": True, }) assert res is not None diff --git a/docs/sdks/clients/README.md b/docs/sdks/clients/README.md index e7d28431..9c7be444 100644 --- a/docs/sdks/clients/README.md +++ b/docs/sdks/clients/README.md @@ -27,7 +27,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.clients.list(paginated=False) + res = clerk.clients.list(paginated=False, limit=20, offset=10) assert res is not None diff --git a/docs/sdks/emailsmstemplates/README.md b/docs/sdks/emailsmstemplates/README.md index d641adeb..ec9a5d55 100644 --- a/docs/sdks/emailsmstemplates/README.md +++ b/docs/sdks/emailsmstemplates/README.md @@ -28,7 +28,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.email_sms_templates.list(template_type=clerk_backend_api.TemplateType.EMAIL, paginated=True) + res = clerk.email_sms_templates.list(template_type=clerk_backend_api.TemplateType.EMAIL, paginated=True, limit=20, offset=10) assert res is not None diff --git a/docs/sdks/invitations/README.md b/docs/sdks/invitations/README.md index 63733741..e3006c15 100644 --- a/docs/sdks/invitations/README.md +++ b/docs/sdks/invitations/README.md @@ -77,7 +77,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.invitations.list(status=clerk_backend_api.ListInvitationsQueryParamStatus.ACCEPTED, query="", order_by="pending", paginated=False) + res = clerk.invitations.list(status=clerk_backend_api.ListInvitationsQueryParamStatus.ACCEPTED, query="", order_by="pending", paginated=False, limit=20, offset=10) assert res is not None diff --git a/docs/sdks/jwttemplates/README.md b/docs/sdks/jwttemplates/README.md index c1c39bcb..50c90d00 100644 --- a/docs/sdks/jwttemplates/README.md +++ b/docs/sdks/jwttemplates/README.md @@ -25,7 +25,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.jwt_templates.list(paginated=True) + res = clerk.jwt_templates.list(paginated=True, limit=20, offset=10) assert res is not None diff --git a/docs/sdks/oauthapplicationssdk/README.md b/docs/sdks/oauthapplicationssdk/README.md index 47d1c29b..e0357543 100644 --- a/docs/sdks/oauthapplicationssdk/README.md +++ b/docs/sdks/oauthapplicationssdk/README.md @@ -29,7 +29,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.oauth_applications.list() + res = clerk.oauth_applications.list(limit=20, offset=10) assert res is not None @@ -78,6 +78,7 @@ with Clerk( "redirect_uris": [ "", ], + "scopes": "profile email public_metadata", "public": True, }) @@ -161,7 +162,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.oauth_applications.update(oauth_application_id="oauth_app_67890", name="Updated OAuth App Name", redirect_uris=None, public=None) + res = clerk.oauth_applications.update(oauth_application_id="oauth_app_67890", name="Updated OAuth App Name", redirect_uris=None, scopes="profile email public_metadata private_metadata", public=None) assert res is not None diff --git a/docs/sdks/organizationdomainssdk/README.md b/docs/sdks/organizationdomainssdk/README.md index ca5c7ded..470c5390 100644 --- a/docs/sdks/organizationdomainssdk/README.md +++ b/docs/sdks/organizationdomainssdk/README.md @@ -68,7 +68,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_domains.list(organization_id="", verified="", enrollment_mode="") + res = clerk.organization_domains.list(organization_id="", verified="", enrollment_mode="", limit=20, offset=10) assert res is not None diff --git a/docs/sdks/organizationinvitationssdk/README.md b/docs/sdks/organizationinvitationssdk/README.md index 4460903d..0f3e0d28 100644 --- a/docs/sdks/organizationinvitationssdk/README.md +++ b/docs/sdks/organizationinvitationssdk/README.md @@ -33,7 +33,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_invitations.get_all(status=clerk_backend_api.ListInstanceOrganizationInvitationsQueryParamStatus.ACCEPTED, query="") + res = clerk.organization_invitations.get_all(order_by="-created_at", status=clerk_backend_api.ListInstanceOrganizationInvitationsQueryParamStatus.ACCEPTED, query="", limit=20, offset=10) assert res is not None @@ -152,7 +152,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_invitations.list(organization_id="org_12345", status=clerk_backend_api.ListOrganizationInvitationsQueryParamStatus.ACCEPTED) + res = clerk.organization_invitations.list(organization_id="org_12345", status=clerk_backend_api.ListOrganizationInvitationsQueryParamStatus.ACCEPTED, limit=20, offset=10) assert res is not None @@ -284,7 +284,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_invitations.list_pending(organization_id="org_12345") + res = clerk.organization_invitations.list_pending(organization_id="org_12345", limit=20, offset=10) assert res is not None diff --git a/docs/sdks/organizationmembershipssdk/README.md b/docs/sdks/organizationmembershipssdk/README.md index f738c4ad..9d356ebb 100644 --- a/docs/sdks/organizationmembershipssdk/README.md +++ b/docs/sdks/organizationmembershipssdk/README.md @@ -82,7 +82,7 @@ with Clerk( "", ], role=[ "", - ], query="", email_address_query="", phone_number_query="", username_query="", name_query="", last_active_at_before=1700690400000, last_active_at_after=1700690400000, created_at_before=1730160000000, created_at_after=1730160000000) + ], query="", email_address_query="", phone_number_query="", username_query="", name_query="", last_active_at_before=1700690400000, last_active_at_after=1700690400000, created_at_before=1730160000000, created_at_after=1730160000000, limit=20, offset=10) assert res is not None diff --git a/docs/sdks/organizationssdk/README.md b/docs/sdks/organizationssdk/README.md index df25dce2..6d71dfd7 100644 --- a/docs/sdks/organizationssdk/README.md +++ b/docs/sdks/organizationssdk/README.md @@ -35,7 +35,7 @@ with Clerk( "clerk", ], organization_id=[ "-name", - ]) + ], order_by="-created_at", limit=20, offset=10) assert res is not None @@ -339,7 +339,6 @@ with Clerk( res = clerk.organizations.upload_logo(organization_id="org_12345", file={ "file_name": "example.file", "content": open("example.file", "rb"), - "content_type": "", }, uploader_user_id="user_67890") assert res is not None diff --git a/docs/sdks/redirecturls/README.md b/docs/sdks/redirecturls/README.md index ad07d70d..107acbc3 100644 --- a/docs/sdks/redirecturls/README.md +++ b/docs/sdks/redirecturls/README.md @@ -24,7 +24,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.redirect_urls.list(paginated=True) + res = clerk.redirect_urls.list(paginated=True, limit=20, offset=10) assert res is not None diff --git a/docs/sdks/samlconnectionssdk/README.md b/docs/sdks/samlconnectionssdk/README.md index d2657e0c..85aafee1 100644 --- a/docs/sdks/samlconnectionssdk/README.md +++ b/docs/sdks/samlconnectionssdk/README.md @@ -27,7 +27,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.saml_connections.list(query="", order_by="", organization_id=[ + res = clerk.saml_connections.list(limit=20, offset=10, query="", order_by="", organization_id=[ "", ]) diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md index f92817af..3f124d22 100644 --- a/docs/sdks/sessions/README.md +++ b/docs/sdks/sessions/README.md @@ -32,7 +32,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.sessions.list(client_id="client_123", user_id="user_456", status=clerk_backend_api.QueryParamStatus.ACTIVE, paginated=True) + res = clerk.sessions.list(client_id="client_123", user_id="user_456", status=clerk_backend_api.QueryParamStatus.ACTIVE, paginated=True, limit=20, offset=10) assert res is not None @@ -159,6 +159,7 @@ are validation errors, which signals the SDKs to fallback to the handshake flow. ### Example Usage ```python +import clerk_backend_api from clerk_backend_api import Clerk @@ -170,7 +171,7 @@ with Clerk( "key": "", "key1": "", "key2": "", - }, request_originating_ip="") + }, format_=clerk_backend_api.Format.TOKEN, request_originating_ip="") assert res is not None diff --git a/docs/sdks/users/README.md b/docs/sdks/users/README.md index 025f36c1..c38f72ca 100644 --- a/docs/sdks/users/README.md +++ b/docs/sdks/users/README.md @@ -79,6 +79,8 @@ with Clerk( "last_active_at_since": 1700690400000, "created_at_before": 1730160000000, "created_at_after": 1730160000000, + "limit": 20, + "offset": 10, }) assert res is not None @@ -126,48 +128,24 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.create(request={ - "external_id": "ext-id-001", - "first_name": "John", - "last_name": "Doe", - "email_address": [ - "john.doe@example.com", - ], - "phone_number": [ - "+12345678901", - ], - "web3_wallet": [ - "0x123456789abcdef0x123456789abcdef", - ], - "username": "johndoe123", - "password": "Secure*Pass4", - "password_digest": "$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc", - "password_hasher": "", - "skip_password_checks": False, - "skip_password_requirement": False, - "totp_secret": "base32totpsecretkey", - "backup_codes": [ - "123456", - "654321", - ], - "public_metadata": { - "role": "user", - }, - "private_metadata": { - "internal_id": "789", - }, - "unsafe_metadata": { - "preferences": { - "theme": "dark", - }, + res = clerk.users.create(external_id="ext-id-001", first_name="John", last_name="Doe", email_address=[ + "john.doe@example.com", + ], phone_number=[ + "+12345678901", + ], web3_wallet=[ + "0x123456789abcdef0x123456789abcdef", + ], username="johndoe123", password="Secure*Pass4", password_digest="$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc", password_hasher="", skip_password_checks=False, skip_password_requirement=False, totp_secret="base32totpsecretkey", backup_codes=[ + "123456", + "654321", + ], public_metadata={ + "role": "user", + }, private_metadata={ + "internal_id": "789", + }, unsafe_metadata={ + "preferences": { + "theme": "dark", }, - "delete_self_enabled": True, - "legal_accepted_at": "", - "skip_legal_checks": False, - "create_organization_enabled": None, - "create_organizations_limit": 81560, - "created_at": "2023-03-15T07:15:20.902Z", - }) + }, delete_self_enabled=True, legal_accepted_at="", skip_legal_checks=False, create_organization_enabled=None, create_organizations_limit=81560, created_at="2023-03-15T07:15:20.902Z") assert res is not None @@ -178,10 +156,32 @@ with Clerk( ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `request` | [models.CreateUserRequestBody](../../models/createuserrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `external_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the user as used in your external systems or your previous authentication solution.
Must be unique across your instance. | ext-id-001 | +| `first_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The first name to assign to the user | John | +| `last_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The last name to assign to the user | Doe | +| `email_address` | List[*str*] | :heavy_minus_sign: | Email addresses to add to the user.
Must be unique across your instance.
The first email address will be set as the user's primary email address. | | +| `phone_number` | List[*str*] | :heavy_minus_sign: | Phone numbers to add to the user.
Must be unique across your instance.
The first phone number will be set as the user's primary phone number. | | +| `web3_wallet` | List[*str*] | :heavy_minus_sign: | Web3 wallets to add to the user.
Must be unique across your instance.
The first wallet will be set as the user's primary wallet. | | +| `username` | *OptionalNullable[str]* | :heavy_minus_sign: | The username to give to the user.
It must be unique across your instance. | johndoe123 | +| `password` | *OptionalNullable[str]* | :heavy_minus_sign: | The plaintext password to give the user.
Must be at least 8 characters long, and can not be in any list of hacked passwords. | Secure*Pass4 | +| `password_digest` | *OptionalNullable[str]* | :heavy_minus_sign: | In case you already have the password digests and not the passwords, you can use them for the newly created user via this property.
The digests should be generated with one of the supported algorithms.
The hashing algorithm can be specified using the `password_hasher` property. | $argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc | +| `password_hasher` | *Optional[str]* | :heavy_minus_sign: | The hashing algorithm that was used to generate the password digest.

The algorithms we support at the moment are [`bcrypt`](https://en.wikipedia.org/wiki/Bcrypt), [`bcrypt_sha256_django`](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/), [`md5`](https://en.wikipedia.org/wiki/MD5), `pbkdf2_sha1`, `pbkdf2_sha256`, [`pbkdf2_sha256_django`](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/),
[`phpass`](https://www.openwall.com/phpass/), [`scrypt_firebase`](https://firebaseopensource.com/projects/firebase/scrypt/),
[`scrypt_werkzeug`](https://werkzeug.palletsprojects.com/en/3.0.x/utils/#werkzeug.security.generate_password_hash), [`sha256`](https://en.wikipedia.org/wiki/SHA-2),
and the [`argon2`](https://argon2.online/) variants: `argon2i` and `argon2id`.

Each of the supported hashers expects the incoming digest to be in a particular format. See the [Clerk docs](https://clerk.com/docs/references/backend/user/create-user) for more information. | | +| `skip_password_checks` | *OptionalNullable[bool]* | :heavy_minus_sign: | When set to `true` all password checks are skipped.
It is recommended to use this method only when migrating plaintext passwords to Clerk.
Upon migration the user base should be prompted to pick stronger password. | false | +| `skip_password_requirement` | *OptionalNullable[bool]* | :heavy_minus_sign: | When set to `true`, `password` is not required anymore when creating the user and can be omitted.
This is useful when you are trying to create a user that doesn't have a password, in an instance that is using passwords.
Please note that you cannot use this flag if password is the only way for a user to sign into your instance. | false | +| `totp_secret` | *OptionalNullable[str]* | :heavy_minus_sign: | In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it.
Please note that currently the supported options are:
* Period: 30 seconds
* Code length: 6 digits
* Algorithm: SHA1 | base32totpsecretkey | +| `backup_codes` | List[*str*] | :heavy_minus_sign: | If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them.
You must provide the backup codes in plain format or the corresponding bcrypt digest. | [
"123456",
"654321"
] | +| `public_metadata` | Dict[str, *Any*] | :heavy_minus_sign: | Metadata saved on the user, that is visible to both your Frontend and Backend APIs | {
"role": "user"
} | +| `private_metadata` | Dict[str, *Any*] | :heavy_minus_sign: | Metadata saved on the user, that is only visible to your Backend API | {
"internal_id": "789"
} | +| `unsafe_metadata` | Dict[str, *Any*] | :heavy_minus_sign: | Metadata saved on the user, that can be updated from both the Frontend and Backend APIs.
Note: Since this data can be modified from the frontend, it is not guaranteed to be safe. | {
"preferences": {
"theme": "dark"
}
} | +| `delete_self_enabled` | *OptionalNullable[bool]* | :heavy_minus_sign: | If enabled, user can delete themselves via FAPI.
| | +| `legal_accepted_at` | *OptionalNullable[str]* | :heavy_minus_sign: | A custom timestamp denoting _when_ the user accepted legal requirements, specified in RFC3339 format (e.g. `2012-10-20T07:15:20.902Z`). | | +| `skip_legal_checks` | *OptionalNullable[bool]* | :heavy_minus_sign: | When set to `true` all legal checks are skipped.
It is not recommended to skip legal checks unless you are migrating a user to Clerk. | | +| `create_organization_enabled` | *OptionalNullable[bool]* | :heavy_minus_sign: | If enabled, user can create organizations via FAPI.
| | +| `create_organizations_limit` | *OptionalNullable[int]* | :heavy_minus_sign: | The maximum number of organizations the user can create. 0 means unlimited.
| | +| `created_at` | *OptionalNullable[str]* | :heavy_minus_sign: | A custom date/time denoting _when_ the user signed up to the application, specified in RFC3339 format (e.g. `2012-10-20T07:15:20.902Z`). | 2023-03-15T07:15:20.902Z | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -332,7 +332,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.update(user_id="usr_1", external_id="ext_123", first_name="Jane", last_name="Doe", primary_email_address_id="eml_12345", primary_phone_number_id="phn_67890", primary_web3_wallet_id="wlt_123", username="janedoe", profile_image_id="img_789", password="secretPass123!", password_digest="$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc", password_hasher="", skip_password_checks=False, sign_out_of_other_sessions=True, totp_secret="ABCD1234EFGH5678", backup_codes=[ + res = clerk.users.update(user_id="usr_1", external_id="ext_123", first_name="Jane", last_name="Doe", primary_email_address_id="eml_12345", notify_primary_email_address_changed=True, primary_phone_number_id="phn_67890", primary_web3_wallet_id="wlt_123", username="janedoe", profile_image_id="img_789", password="secretPass123!", password_digest="$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc", password_hasher="", skip_password_checks=False, sign_out_of_other_sessions=True, totp_secret="ABCD1234EFGH5678", backup_codes=[ "123456", "654321", ], public_metadata={ @@ -616,7 +616,6 @@ with Clerk( res = clerk.users.set_profile_image(user_id="usr_test123", file={ "file_name": "example.file", "content": open("example.file", "rb"), - "content_type": "", }) assert res is not None @@ -760,7 +759,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.get_o_auth_access_token(user_id="user_123", provider="oauth_google", paginated=True) + res = clerk.users.get_o_auth_access_token(user_id="user_123", provider="oauth_google", paginated=True, limit=20, offset=10) assert res is not None @@ -805,7 +804,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.get_organization_memberships(user_id="usr_1234567890") + res = clerk.users.get_organization_memberships(user_id="usr_1234567890", limit=20, offset=10) assert res is not None @@ -849,7 +848,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.get_organization_invitations(user_id="", status=clerk_backend_api.UsersGetOrganizationInvitationsQueryParamStatus.PENDING) + res = clerk.users.get_organization_invitations(user_id="", limit=20, offset=10, status=clerk_backend_api.UsersGetOrganizationInvitationsQueryParamStatus.PENDING) assert res is not None @@ -1236,7 +1235,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.get_instance_organization_memberships(order_by="") + res = clerk.users.get_instance_organization_memberships(order_by="", limit=20, offset=10) assert res is not None diff --git a/docs/sdks/waitlistentriessdk/README.md b/docs/sdks/waitlistentriessdk/README.md index 41e7fb7e..e0f8eec8 100644 --- a/docs/sdks/waitlistentriessdk/README.md +++ b/docs/sdks/waitlistentriessdk/README.md @@ -25,7 +25,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.waitlist_entries.list(query="", status=clerk_backend_api.ListWaitlistEntriesQueryParamStatus.INVITED) + res = clerk.waitlist_entries.list(limit=20, offset=10, query="", status=clerk_backend_api.ListWaitlistEntriesQueryParamStatus.INVITED, order_by="-created_at") assert res is not None diff --git a/pyproject.toml b/pyproject.toml index 80e8abc3..494ecd35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "clerk-backend-api" -version = "3.0.2" +version = "3.0.3" description = "Python Client SDK for clerk.dev" authors = [{ name = "Clerk" },] readme = "README-PYPI.md" diff --git a/src/clerk_backend_api/_version.py b/src/clerk_backend_api/_version.py index 526919a9..dd412eca 100644 --- a/src/clerk_backend_api/_version.py +++ b/src/clerk_backend_api/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "clerk-backend-api" -__version__: str = "3.0.2" +__version__: str = "3.0.3" __openapi_doc_version__: str = "2025-03-12" -__gen_version__: str = "2.618.0" -__user_agent__: str = "speakeasy-sdk/python 3.0.2 2.618.0 2025-03-12 clerk-backend-api" +__gen_version__: str = "2.623.2" +__user_agent__: str = "speakeasy-sdk/python 3.0.3 2.623.2 2025-03-12 clerk-backend-api" try: if __package__ is not None: diff --git a/src/clerk_backend_api/models/organizationmembership.py b/src/clerk_backend_api/models/organizationmembership.py index 9f0e6b9c..a3025c8b 100644 --- a/src/clerk_backend_api/models/organizationmembership.py +++ b/src/clerk_backend_api/models/organizationmembership.py @@ -5,8 +5,9 @@ OrganizationMembershipPublicUserData, OrganizationMembershipPublicUserDataTypedDict, ) -from clerk_backend_api.types import BaseModel +from clerk_backend_api.types import BaseModel, Nullable, UNSET_SENTINEL from enum import Enum +from pydantic import model_serializer from typing import Any, Dict, List, Optional from typing_extensions import NotRequired, TypedDict @@ -89,7 +90,7 @@ class OrganizationMembershipTypedDict(TypedDict): """ role: str - permissions: List[str] + permissions: Nullable[List[str]] public_metadata: Dict[str, Any] r"""Metadata saved on the organization membership, accessible from both Frontend and Backend APIs""" organization: OrganizationMembershipOrganizationTypedDict @@ -116,7 +117,7 @@ class OrganizationMembership(BaseModel): role: str - permissions: List[str] + permissions: Nullable[List[str]] public_metadata: Dict[str, Any] r"""Metadata saved on the organization membership, accessible from both Frontend and Backend APIs""" @@ -136,3 +137,33 @@ class OrganizationMembership(BaseModel): public_user_data: Optional[OrganizationMembershipPublicUserData] = None r"""An organization membership with public user data populated""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["role_name", "private_metadata", "public_user_data"] + nullable_fields = ["permissions"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/clerk_backend_api/users.py b/src/clerk_backend_api/users.py index 5253f54f..508a20f6 100644 --- a/src/clerk_backend_api/users.py +++ b/src/clerk_backend_api/users.py @@ -217,9 +217,29 @@ async def list_async( def create( self, *, - request: Union[ - models.CreateUserRequestBody, models.CreateUserRequestBodyTypedDict - ] = models.CreateUserRequestBody(), + external_id: OptionalNullable[str] = UNSET, + first_name: OptionalNullable[str] = UNSET, + last_name: OptionalNullable[str] = UNSET, + email_address: Optional[List[str]] = None, + phone_number: Optional[List[str]] = None, + web3_wallet: Optional[List[str]] = None, + username: OptionalNullable[str] = UNSET, + password: OptionalNullable[str] = UNSET, + password_digest: OptionalNullable[str] = UNSET, + password_hasher: Optional[str] = None, + skip_password_checks: OptionalNullable[bool] = UNSET, + skip_password_requirement: OptionalNullable[bool] = UNSET, + totp_secret: OptionalNullable[str] = UNSET, + backup_codes: Optional[List[str]] = None, + public_metadata: Optional[Dict[str, Any]] = None, + private_metadata: Optional[Dict[str, Any]] = None, + unsafe_metadata: Optional[Dict[str, Any]] = None, + delete_self_enabled: OptionalNullable[bool] = UNSET, + legal_accepted_at: OptionalNullable[str] = UNSET, + skip_legal_checks: OptionalNullable[bool] = UNSET, + create_organization_enabled: OptionalNullable[bool] = UNSET, + create_organizations_limit: OptionalNullable[int] = UNSET, + created_at: OptionalNullable[str] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -235,7 +255,29 @@ def create( A rate limit rule of 20 requests per 10 seconds is applied to this endpoint. - :param request: The request object to send. + :param external_id: The ID of the user as used in your external systems or your previous authentication solution. Must be unique across your instance. + :param first_name: The first name to assign to the user + :param last_name: The last name to assign to the user + :param email_address: Email addresses to add to the user. Must be unique across your instance. The first email address will be set as the user's primary email address. + :param phone_number: Phone numbers to add to the user. Must be unique across your instance. The first phone number will be set as the user's primary phone number. + :param web3_wallet: Web3 wallets to add to the user. Must be unique across your instance. The first wallet will be set as the user's primary wallet. + :param username: The username to give to the user. It must be unique across your instance. + :param password: The plaintext password to give the user. Must be at least 8 characters long, and can not be in any list of hacked passwords. + :param password_digest: In case you already have the password digests and not the passwords, you can use them for the newly created user via this property. The digests should be generated with one of the supported algorithms. The hashing algorithm can be specified using the `password_hasher` property. + :param password_hasher: The hashing algorithm that was used to generate the password digest. The algorithms we support at the moment are [`bcrypt`](https://en.wikipedia.org/wiki/Bcrypt), [`bcrypt_sha256_django`](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/), [`md5`](https://en.wikipedia.org/wiki/MD5), `pbkdf2_sha1`, `pbkdf2_sha256`, [`pbkdf2_sha256_django`](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/), [`phpass`](https://www.openwall.com/phpass/), [`scrypt_firebase`](https://firebaseopensource.com/projects/firebase/scrypt/), [`scrypt_werkzeug`](https://werkzeug.palletsprojects.com/en/3.0.x/utils/#werkzeug.security.generate_password_hash), [`sha256`](https://en.wikipedia.org/wiki/SHA-2), and the [`argon2`](https://argon2.online/) variants: `argon2i` and `argon2id`. Each of the supported hashers expects the incoming digest to be in a particular format. See the [Clerk docs](https://clerk.com/docs/references/backend/user/create-user) for more information. + :param skip_password_checks: When set to `true` all password checks are skipped. It is recommended to use this method only when migrating plaintext passwords to Clerk. Upon migration the user base should be prompted to pick stronger password. + :param skip_password_requirement: When set to `true`, `password` is not required anymore when creating the user and can be omitted. This is useful when you are trying to create a user that doesn't have a password, in an instance that is using passwords. Please note that you cannot use this flag if password is the only way for a user to sign into your instance. + :param totp_secret: In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it. Please note that currently the supported options are: * Period: 30 seconds * Code length: 6 digits * Algorithm: SHA1 + :param backup_codes: If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them. You must provide the backup codes in plain format or the corresponding bcrypt digest. + :param public_metadata: Metadata saved on the user, that is visible to both your Frontend and Backend APIs + :param private_metadata: Metadata saved on the user, that is only visible to your Backend API + :param unsafe_metadata: Metadata saved on the user, that can be updated from both the Frontend and Backend APIs. Note: Since this data can be modified from the frontend, it is not guaranteed to be safe. + :param delete_self_enabled: If enabled, user can delete themselves via FAPI. + :param legal_accepted_at: A custom timestamp denoting _when_ the user accepted legal requirements, specified in RFC3339 format (e.g. `2012-10-20T07:15:20.902Z`). + :param skip_legal_checks: When set to `true` all legal checks are skipped. It is not recommended to skip legal checks unless you are migrating a user to Clerk. + :param create_organization_enabled: If enabled, user can create organizations via FAPI. + :param create_organizations_limit: The maximum number of organizations the user can create. 0 means unlimited. + :param created_at: A custom date/time denoting _when_ the user signed up to the application, specified in RFC3339 format (e.g. `2012-10-20T07:15:20.902Z`). :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -251,9 +293,31 @@ def create( else: base_url = self._get_url(base_url, url_variables) - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, models.CreateUserRequestBody) - request = cast(models.CreateUserRequestBody, request) + request = models.CreateUserRequestBody( + external_id=external_id, + first_name=first_name, + last_name=last_name, + email_address=email_address, + phone_number=phone_number, + web3_wallet=web3_wallet, + username=username, + password=password, + password_digest=password_digest, + password_hasher=password_hasher, + skip_password_checks=skip_password_checks, + skip_password_requirement=skip_password_requirement, + totp_secret=totp_secret, + backup_codes=backup_codes, + public_metadata=public_metadata, + private_metadata=private_metadata, + unsafe_metadata=unsafe_metadata, + delete_self_enabled=delete_self_enabled, + legal_accepted_at=legal_accepted_at, + skip_legal_checks=skip_legal_checks, + create_organization_enabled=create_organization_enabled, + create_organizations_limit=create_organizations_limit, + created_at=created_at, + ) req = self._build_request( method="POST", @@ -269,7 +333,7 @@ def create( http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, True, "json", Optional[models.CreateUserRequestBody] + request, False, False, "json", models.CreateUserRequestBody ), timeout_ms=timeout_ms, ) @@ -330,9 +394,29 @@ def create( async def create_async( self, *, - request: Union[ - models.CreateUserRequestBody, models.CreateUserRequestBodyTypedDict - ] = models.CreateUserRequestBody(), + external_id: OptionalNullable[str] = UNSET, + first_name: OptionalNullable[str] = UNSET, + last_name: OptionalNullable[str] = UNSET, + email_address: Optional[List[str]] = None, + phone_number: Optional[List[str]] = None, + web3_wallet: Optional[List[str]] = None, + username: OptionalNullable[str] = UNSET, + password: OptionalNullable[str] = UNSET, + password_digest: OptionalNullable[str] = UNSET, + password_hasher: Optional[str] = None, + skip_password_checks: OptionalNullable[bool] = UNSET, + skip_password_requirement: OptionalNullable[bool] = UNSET, + totp_secret: OptionalNullable[str] = UNSET, + backup_codes: Optional[List[str]] = None, + public_metadata: Optional[Dict[str, Any]] = None, + private_metadata: Optional[Dict[str, Any]] = None, + unsafe_metadata: Optional[Dict[str, Any]] = None, + delete_self_enabled: OptionalNullable[bool] = UNSET, + legal_accepted_at: OptionalNullable[str] = UNSET, + skip_legal_checks: OptionalNullable[bool] = UNSET, + create_organization_enabled: OptionalNullable[bool] = UNSET, + create_organizations_limit: OptionalNullable[int] = UNSET, + created_at: OptionalNullable[str] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -348,7 +432,29 @@ async def create_async( A rate limit rule of 20 requests per 10 seconds is applied to this endpoint. - :param request: The request object to send. + :param external_id: The ID of the user as used in your external systems or your previous authentication solution. Must be unique across your instance. + :param first_name: The first name to assign to the user + :param last_name: The last name to assign to the user + :param email_address: Email addresses to add to the user. Must be unique across your instance. The first email address will be set as the user's primary email address. + :param phone_number: Phone numbers to add to the user. Must be unique across your instance. The first phone number will be set as the user's primary phone number. + :param web3_wallet: Web3 wallets to add to the user. Must be unique across your instance. The first wallet will be set as the user's primary wallet. + :param username: The username to give to the user. It must be unique across your instance. + :param password: The plaintext password to give the user. Must be at least 8 characters long, and can not be in any list of hacked passwords. + :param password_digest: In case you already have the password digests and not the passwords, you can use them for the newly created user via this property. The digests should be generated with one of the supported algorithms. The hashing algorithm can be specified using the `password_hasher` property. + :param password_hasher: The hashing algorithm that was used to generate the password digest. The algorithms we support at the moment are [`bcrypt`](https://en.wikipedia.org/wiki/Bcrypt), [`bcrypt_sha256_django`](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/), [`md5`](https://en.wikipedia.org/wiki/MD5), `pbkdf2_sha1`, `pbkdf2_sha256`, [`pbkdf2_sha256_django`](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/), [`phpass`](https://www.openwall.com/phpass/), [`scrypt_firebase`](https://firebaseopensource.com/projects/firebase/scrypt/), [`scrypt_werkzeug`](https://werkzeug.palletsprojects.com/en/3.0.x/utils/#werkzeug.security.generate_password_hash), [`sha256`](https://en.wikipedia.org/wiki/SHA-2), and the [`argon2`](https://argon2.online/) variants: `argon2i` and `argon2id`. Each of the supported hashers expects the incoming digest to be in a particular format. See the [Clerk docs](https://clerk.com/docs/references/backend/user/create-user) for more information. + :param skip_password_checks: When set to `true` all password checks are skipped. It is recommended to use this method only when migrating plaintext passwords to Clerk. Upon migration the user base should be prompted to pick stronger password. + :param skip_password_requirement: When set to `true`, `password` is not required anymore when creating the user and can be omitted. This is useful when you are trying to create a user that doesn't have a password, in an instance that is using passwords. Please note that you cannot use this flag if password is the only way for a user to sign into your instance. + :param totp_secret: In case TOTP is configured on the instance, you can provide the secret to enable it on the newly created user without the need to reset it. Please note that currently the supported options are: * Period: 30 seconds * Code length: 6 digits * Algorithm: SHA1 + :param backup_codes: If Backup Codes are configured on the instance, you can provide them to enable it on the newly created user without the need to reset them. You must provide the backup codes in plain format or the corresponding bcrypt digest. + :param public_metadata: Metadata saved on the user, that is visible to both your Frontend and Backend APIs + :param private_metadata: Metadata saved on the user, that is only visible to your Backend API + :param unsafe_metadata: Metadata saved on the user, that can be updated from both the Frontend and Backend APIs. Note: Since this data can be modified from the frontend, it is not guaranteed to be safe. + :param delete_self_enabled: If enabled, user can delete themselves via FAPI. + :param legal_accepted_at: A custom timestamp denoting _when_ the user accepted legal requirements, specified in RFC3339 format (e.g. `2012-10-20T07:15:20.902Z`). + :param skip_legal_checks: When set to `true` all legal checks are skipped. It is not recommended to skip legal checks unless you are migrating a user to Clerk. + :param create_organization_enabled: If enabled, user can create organizations via FAPI. + :param create_organizations_limit: The maximum number of organizations the user can create. 0 means unlimited. + :param created_at: A custom date/time denoting _when_ the user signed up to the application, specified in RFC3339 format (e.g. `2012-10-20T07:15:20.902Z`). :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -364,9 +470,31 @@ async def create_async( else: base_url = self._get_url(base_url, url_variables) - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, models.CreateUserRequestBody) - request = cast(models.CreateUserRequestBody, request) + request = models.CreateUserRequestBody( + external_id=external_id, + first_name=first_name, + last_name=last_name, + email_address=email_address, + phone_number=phone_number, + web3_wallet=web3_wallet, + username=username, + password=password, + password_digest=password_digest, + password_hasher=password_hasher, + skip_password_checks=skip_password_checks, + skip_password_requirement=skip_password_requirement, + totp_secret=totp_secret, + backup_codes=backup_codes, + public_metadata=public_metadata, + private_metadata=private_metadata, + unsafe_metadata=unsafe_metadata, + delete_self_enabled=delete_self_enabled, + legal_accepted_at=legal_accepted_at, + skip_legal_checks=skip_legal_checks, + create_organization_enabled=create_organization_enabled, + create_organizations_limit=create_organizations_limit, + created_at=created_at, + ) req = self._build_request_async( method="POST", @@ -382,7 +510,7 @@ async def create_async( http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, True, "json", Optional[models.CreateUserRequestBody] + request, False, False, "json", models.CreateUserRequestBody ), timeout_ms=timeout_ms, )