diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index bd1450b..65bb63a 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: 71c79847d66ec9266de8dac133004f2c + docChecksum: b38d2555c95ce0fd804e5caf98da547b docVersion: v1 - speakeasyVersion: 1.438.0 - generationVersion: 2.457.1 - releaseVersion: 1.3.1 - configChecksum: 658cd1dccb21eefe19cc7bd36410f63b + speakeasyVersion: 1.448.0 + generationVersion: 2.466.0 + releaseVersion: 1.4.0 + configChecksum: d230d40f9aa069e972589344260c6aa8 repoURL: https://github.com/clerk/clerk-sdk-python.git installationURL: https://github.com/clerk/clerk-sdk-python.git published: true @@ -14,8 +14,8 @@ features: python: additionalDependencies: 1.0.0 additionalProperties: 1.0.1 - constsAndDefaults: 1.0.4 - core: 5.6.4 + constsAndDefaults: 1.0.5 + core: 5.6.8 defaultEnabledRetries: 0.2.0 deprecations: 3.0.0 enumUnions: 0.1.0 @@ -36,8 +36,7 @@ features: responseFormat: 1.0.1 retries: 3.0.2 sdkHooks: 1.0.0 - tests: 1.6.0 - unions: 3.0.3 + unions: 3.0.4 uploadStreams: 1.0.0 generatedFiles: - .gitattributes @@ -1213,7 +1212,7 @@ examples: web3_wallet: ["0x123456789abcdef0x123456789abcdef"] 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": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "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}, "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": "admin", "attempts": 0, "expire_at": 1620000000}, "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", "attempts": null, "expire_at": null}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "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": "ticket", "attempts": null, "expire_at": 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": 177706, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000}, {"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": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "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}, "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": "admin", "attempts": 0, "expire_at": 1620000000}, "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", "attempts": null, "expire_at": null}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "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": "ticket", "attempts": null, "expire_at": 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": true, "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": 635532, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000}, {"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": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "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}, "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": "admin", "attempts": 0, "expire_at": 1620000000}, "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", "attempts": null, "expire_at": null}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "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": "ticket", "attempts": null, "expire_at": 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": true, "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": 68504, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000}] + 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": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "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}, "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": "admin", "attempts": 0, "expire_at": 1620000000}, "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", "attempts": null, "expire_at": null}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "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", "attempts": null, "expire_at": 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": 177706, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000}, {"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": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "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}, "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": "admin", "attempts": 0, "expire_at": 1620000000}, "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", "attempts": null, "expire_at": null}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "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", "attempts": null, "expire_at": 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": true, "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": 635532, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000}, {"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": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "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}, "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": "admin", "attempts": 0, "expire_at": 1620000000}, "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", "attempts": null, "expire_at": null}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "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", "attempts": null, "expire_at": 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": true, "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": 68504, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000}] "400": application/json: {"errors": [{"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}], "meta": {}} GetUsersCount: @@ -1934,3 +1933,4 @@ examples: application/json: {"id": "", "object": "organization_domain", "organization_id": "", "name": "", "enrollment_mode": "automatic_invitation", "affiliation_email_address": "", "verification": {"status": "unverified", "strategy": "", "attempts": 991464, "expire_at": 627690}, "total_pending_invitations": 488852, "total_pending_suggestions": 984008, "created_at": 54062, "updated_at": 896501} "400": application/json: {"errors": [{"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}], "meta": {}} +generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 7356d6b..1c7f1a5 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false python: - version: 1.3.1 + version: 1.4.0 additionalDependencies: dev: pytest: ^8.3.3 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index f7372a0..fd3c058 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,20 +1,21 @@ -speakeasyVersion: 1.438.0 +speakeasyVersion: 1.448.0 sources: clerk-openapi: sourceNamespace: clerk-openapi - sourceRevisionDigest: sha256:e89d3d42646d1804adab2c71e3590848a232acd0a6e18e1bddbdacbbebd22c57 - sourceBlobDigest: sha256:44d33d8984dd639bbff908aee705242bc26fc9fcd380c4b3f355f419767172b2 + sourceRevisionDigest: sha256:c28f47287a7b4933285aff49a199931d37e8e7e8ce75e88468140f95f284e331 + sourceBlobDigest: sha256:d20d10387a61e374eef4ee2b380b1e3798c4d43a1fa1d085fe3782672234d708 tags: - latest - - main + - speakeasy-sdk-regen-1732580417 + - v1 targets: clerk-sdk-python: source: clerk-openapi sourceNamespace: clerk-openapi - sourceRevisionDigest: sha256:e89d3d42646d1804adab2c71e3590848a232acd0a6e18e1bddbdacbbebd22c57 - sourceBlobDigest: sha256:44d33d8984dd639bbff908aee705242bc26fc9fcd380c4b3f355f419767172b2 - codeSamplesNamespace: clerk-openapi-code-samples - codeSamplesRevisionDigest: sha256:451997437b6cb4252f6235d61551d71e090c734b87e291437dcb200d975e8b2d + sourceRevisionDigest: sha256:c28f47287a7b4933285aff49a199931d37e8e7e8ce75e88468140f95f284e331 + sourceBlobDigest: sha256:d20d10387a61e374eef4ee2b380b1e3798c4d43a1fa1d085fe3782672234d708 + codeSamplesNamespace: clerk-openapi-python-code-samples + codeSamplesRevisionDigest: sha256:dbd857b062cde8a584b23d94a7d5f2187513871d02a8e8b16c0d114dcfab9c61 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -38,5 +39,5 @@ workflow: token: $pypi_token codeSamples: registry: - location: registry.speakeasyapi.dev/clerk/clerk/clerk-openapi-code-samples + location: registry.speakeasyapi.dev/clerk/clerk/clerk-openapi-python-code-samples blocking: false diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 10271ed..66dcda0 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -20,5 +20,5 @@ targets: token: $pypi_token codeSamples: registry: - location: registry.speakeasyapi.dev/clerk/clerk/clerk-openapi-code-samples + location: registry.speakeasyapi.dev/clerk/clerk/clerk-openapi-python-code-samples blocking: false diff --git a/README.md b/README.md index 36ecab7..f80001e 100644 --- a/README.md +++ b/README.md @@ -88,15 +88,14 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u # Synchronous Example from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.email_addresses.get(email_address_id="email_address_id_example") -res = s.email_addresses.get(email_address_id="email_address_id_example") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ```
@@ -108,13 +107,14 @@ import asyncio from clerk_backend_api import Clerk async def main(): - s = Clerk( + async with Clerk( bearer_auth="", - ) - res = await s.email_addresses.get_async(email_address_id="email_address_id_example") - if res is not None: - # handle response - pass + ) as s: + res = await s.email_addresses.get_async(email_address_id="email_address_id_example") + + if res is not None: + # handle response + pass asyncio.run(main()) ``` @@ -365,19 +365,18 @@ Certain SDK methods accept file objects as part of a request body or multi-part ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.set_profile_image(user_id="usr_test123", file={ - "file_name": "example.file", - "content": open("example.file", "rb"), - "content_type": "", -}) +) as s: + res = s.users.set_profile_image(user_id="usr_test123", file={ + "file_name": "example.file", + "content": open("example.file", "rb"), + "content_type": "", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -392,12 +391,11 @@ To change the default retry strategy for a single API call, simply provide a `Re from clerk.utils import BackoffStrategy, RetryConfig from clerk_backend_api import Clerk -s = Clerk() - -s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d", - RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False)) +with Clerk() as s: + s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d", + RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False)) -# Use the SDK ... + # Use the SDK ... ``` @@ -406,13 +404,12 @@ If you'd like to override the default retry strategy for all operations that sup from clerk.utils import BackoffStrategy, RetryConfig from clerk_backend_api import Clerk -s = Clerk( +with Clerk( retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False), -) - -s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d") +) as s: + s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d") -# Use the SDK ... + # Use the SDK ... ``` @@ -443,26 +440,25 @@ When custom error responses are specified for an operation, the SDK may also rai ```python from clerk_backend_api import Clerk, models -s = Clerk( +with Clerk( bearer_auth="", -) - -res = None -try: - res = s.clients.verify(request={ - "token": "jwt_token_example", - }) - - if res is not None: - # handle response - pass - -except models.ClerkErrors as e: - # handle e.data: models.ClerkErrorsData - raise(e) -except models.SDKError as e: - # handle exception - raise(e) +) as s: + res = None + try: + res = s.clients.verify(request={ + "token": "jwt_token_example", + }) + + if res is not None: + # handle response + pass + + except models.ClerkErrors as e: + # handle e.data: models.ClerkErrorsData + raise(e) + except models.SDKError as e: + # handle exception + raise(e) ``` @@ -475,13 +471,12 @@ The default server can also be overridden globally by passing a URL to the `serv ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( server_url="https://api.clerk.com/v1", -) - -s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d") +) as s: + s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d") -# Use the SDK ... + # Use the SDK ... ``` @@ -582,13 +577,12 @@ To authenticate with the API the `bearer_auth` parameter must be set when initia ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d") +) as s: + s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d") -# Use the SDK ... + # Use the SDK ... ``` diff --git a/RELEASES.md b/RELEASES.md index d9d0d63..4e00991 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -188,4 +188,14 @@ Based on: ### Generated - [python v1.3.1] . ### Releases -- [PyPI v1.3.1] https://pypi.org/project/clerk-backend-api/1.3.1 - . \ No newline at end of file +- [PyPI v1.3.1] https://pypi.org/project/clerk-backend-api/1.3.1 - . + +## 2024-11-27 14:15:09 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.448.0 (2.466.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.4.0] . +### Releases +- [PyPI v1.4.0] https://pypi.org/project/clerk-backend-api/1.4.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index f85ba15..20ea809 100644 --- a/USAGE.md +++ b/USAGE.md @@ -3,15 +3,14 @@ # Synchronous Example from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.email_addresses.get(email_address_id="email_address_id_example") -res = s.email_addresses.get(email_address_id="email_address_id_example") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ```
@@ -23,13 +22,14 @@ import asyncio from clerk_backend_api import Clerk async def main(): - s = Clerk( + async with Clerk( bearer_auth="", - ) - res = await s.email_addresses.get_async(email_address_id="email_address_id_example") - if res is not None: - # handle response - pass + ) as s: + res = await s.email_addresses.get_async(email_address_id="email_address_id_example") + + if res is not None: + # handle response + pass asyncio.run(main()) ``` diff --git a/docs/models/ticketverificationstrategy.md b/docs/models/ticketverificationstrategy.md index 6287be6..c8fb538 100644 --- a/docs/models/ticketverificationstrategy.md +++ b/docs/models/ticketverificationstrategy.md @@ -5,4 +5,5 @@ | Name | Value | | -------- | -------- | -| `TICKET` | ticket | \ No newline at end of file +| `TICKET` | ticket | +| `SAML` | saml | \ No newline at end of file diff --git a/docs/models/updateemailaddressrequest.md b/docs/models/updateemailaddressrequest.md index 0aa8ed5..99a6d3f 100644 --- a/docs/models/updateemailaddressrequest.md +++ b/docs/models/updateemailaddressrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `email_address_id` | *str* | :heavy_check_mark: | The ID of the email address to update | email_address_id_example | -| `request_body` | [Optional[models.UpdateEmailAddressRequestBody]](../models/updateemailaddressrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `email_address_id` | *str* | :heavy_check_mark: | The ID of the email address to update | email_address_id_example | +| `request_body` | [models.UpdateEmailAddressRequestBody](../models/updateemailaddressrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/updatejwttemplaterequest.md b/docs/models/updatejwttemplaterequest.md index 3b8f983..2a676a8 100644 --- a/docs/models/updatejwttemplaterequest.md +++ b/docs/models/updatejwttemplaterequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `template_id` | *str* | :heavy_check_mark: | The ID of the JWT template to update | -| `request_body` | [Optional[models.UpdateJWTTemplateRequestBody]](../models/updatejwttemplaterequestbody.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `template_id` | *str* | :heavy_check_mark: | The ID of the JWT template to update | +| `request_body` | [models.UpdateJWTTemplateRequestBody](../models/updatejwttemplaterequestbody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/updatephonenumberrequest.md b/docs/models/updatephonenumberrequest.md index 47c385c..4bae0db 100644 --- a/docs/models/updatephonenumberrequest.md +++ b/docs/models/updatephonenumberrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `phone_number_id` | *str* | :heavy_check_mark: | The ID of the phone number to update | phone_12345 | -| `request_body` | [Optional[models.UpdatePhoneNumberRequestBody]](../models/updatephonenumberrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `phone_number_id` | *str* | :heavy_check_mark: | The ID of the phone number to update | phone_12345 | +| `request_body` | [models.UpdatePhoneNumberRequestBody](../models/updatephonenumberrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/updatesignuprequest.md b/docs/models/updatesignuprequest.md index 5d03372..57d74cc 100644 --- a/docs/models/updatesignuprequest.md +++ b/docs/models/updatesignuprequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The ID of the sign-up to update | signup_1234567890abcdef | -| `request_body` | [Optional[models.UpdateSignUpRequestBody]](../models/updatesignuprequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The ID of the sign-up to update | signup_1234567890abcdef | +| `request_body` | [models.UpdateSignUpRequestBody](../models/updatesignuprequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/updateusermetadatarequest.md b/docs/models/updateusermetadatarequest.md index dd5fc87..a7ba3c9 100644 --- a/docs/models/updateusermetadatarequest.md +++ b/docs/models/updateusermetadatarequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `user_id` | *str* | :heavy_check_mark: | The ID of the user whose metadata will be updated and merged | user_123456789 | -| `request_body` | [Optional[models.UpdateUserMetadataRequestBody]](../models/updateusermetadatarequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `user_id` | *str* | :heavy_check_mark: | The ID of the user whose metadata will be updated and merged | user_123456789 | +| `request_body` | [models.UpdateUserMetadataRequestBody](../models/updateusermetadatarequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/uploadorganizationlogorequest.md b/docs/models/uploadorganizationlogorequest.md index 9880db5..c3d3fdc 100644 --- a/docs/models/uploadorganizationlogorequest.md +++ b/docs/models/uploadorganizationlogorequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `organization_id` | *str* | :heavy_check_mark: | The ID of the organization for which to upload a logo | org_12345 | -| `request_body` | [Optional[models.UploadOrganizationLogoRequestBody]](../models/uploadorganizationlogorequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `organization_id` | *str* | :heavy_check_mark: | The ID of the organization for which to upload a logo | org_12345 | +| `request_body` | [models.UploadOrganizationLogoRequestBody](../models/uploadorganizationlogorequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/verifyclientrequestbody.md b/docs/models/verifyclientrequestbody.md index 59d6125..e47e123 100644 --- a/docs/models/verifyclientrequestbody.md +++ b/docs/models/verifyclientrequestbody.md @@ -1,7 +1,5 @@ # VerifyClientRequestBody -Parameters. - ## Fields diff --git a/docs/models/verifypasswordrequest.md b/docs/models/verifypasswordrequest.md index 17801cd..99a1170 100644 --- a/docs/models/verifypasswordrequest.md +++ b/docs/models/verifypasswordrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `user_id` | *str* | :heavy_check_mark: | The ID of the user for whom to verify the password | user_123 | -| `request_body` | [Optional[models.VerifyPasswordRequestBody]](../models/verifypasswordrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `user_id` | *str* | :heavy_check_mark: | The ID of the user for whom to verify the password | user_123 | +| `request_body` | [models.VerifyPasswordRequestBody](../models/verifypasswordrequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/verifytotprequest.md b/docs/models/verifytotprequest.md index e63e932..177d749 100644 --- a/docs/models/verifytotprequest.md +++ b/docs/models/verifytotprequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `user_id` | *str* | :heavy_check_mark: | The ID of the user for whom to verify the TOTP | usr_1a2b3c | -| `request_body` | [Optional[models.VerifyTOTPRequestBody]](../models/verifytotprequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `user_id` | *str* | :heavy_check_mark: | The ID of the user for whom to verify the TOTP | usr_1a2b3c | +| `request_body` | [models.VerifyTOTPRequestBody](../models/verifytotprequestbody.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/sdks/actortokens/README.md b/docs/sdks/actortokens/README.md index b3003e4..788cc89 100644 --- a/docs/sdks/actortokens/README.md +++ b/docs/sdks/actortokens/README.md @@ -18,29 +18,26 @@ The `actor` parameter needs to include at least a "sub" key whose value is the I ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.actor_tokens.create(user_id="user_1a2b3c", actor={}, expires_in_seconds=3600, session_max_duration_in_seconds=1800) -res = s.actor_tokens.create(request={ - "user_id": "user_1a2b3c", - "actor": {}, - "expires_in_seconds": 3600, - "session_max_duration_in_seconds": 1800, -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `request` | [models.CreateActorTokenRequestBody](../../models/createactortokenrequestbody.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 | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `user_id` | *str* | :heavy_check_mark: | The ID of the user being impersonated. | user_1a2b3c | +| `actor` | [models.CreateActorTokenActor](../../models/createactortokenactor.md) | :heavy_check_mark: | The actor payload. It needs to include a sub property which should contain the ID of the actor.
This whole payload will be also included in the JWT session token. | {
"sub": "user_2OEpKhcCN1Lat9NQ0G6puh7q5Rb"
} | +| `expires_in_seconds` | *Optional[int]* | :heavy_minus_sign: | Optional parameter to specify the life duration of the actor token in seconds.
By default, the duration is 1 hour. | 3600 | +| `session_max_duration_in_seconds` | *Optional[int]* | :heavy_minus_sign: | The maximum duration that the session which will be created by the generated actor token should last.
By default, the duration of a session created via an actor token, lasts 30 minutes. | 1800 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -62,15 +59,14 @@ Revokes a pending actor token. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.actor_tokens.revoke(actor_token_id="act_tok_abcdefghijk") +) as s: + res = s.actor_tokens.revoke(actor_token_id="act_tok_abcdefghijk") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/allowlistblocklist/README.md b/docs/sdks/allowlistblocklist/README.md index 370c3d2..5dc4e1d 100644 --- a/docs/sdks/allowlistblocklist/README.md +++ b/docs/sdks/allowlistblocklist/README.md @@ -19,15 +19,14 @@ Get a list of all identifiers allowed to sign up to an instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.allowlist_blocklist.list_allowlist_identifiers() -res = s.allowlist_blocklist.list_allowlist_identifiers() - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -57,27 +56,24 @@ Create an identifier allowed to sign up to an instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.allowlist_blocklist.create_allowlist_identifier(request={ - "identifier": "user@example.com", - "notify": True, -}) +) as s: + res = s.allowlist_blocklist.create_allowlist_identifier(identifier="user@example.com", notify=True) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `request` | [models.CreateAllowlistIdentifierRequestBody](../../models/createallowlistidentifierrequestbody.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 | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `identifier` | *str* | :heavy_check_mark: | The identifier to be added in the allow-list.
This can be an email address, a phone number or a web3 wallet. | user@example.com | +| `notify` | *Optional[bool]* | :heavy_minus_sign: | This flag denotes whether the given identifier will receive an invitation to join the application.
Note that this only works for email address and phone number identifiers. | true | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -99,26 +95,23 @@ Create an identifier that is blocked from accessing an instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.allowlist_blocklist.create_blocklist_identifier(identifier="example@example.com") -res = s.allowlist_blocklist.create_blocklist_identifier(request={ - "identifier": "example@example.com", -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `request` | [models.CreateBlocklistIdentifierRequestBody](../../models/createblocklistidentifierrequestbody.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 | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `identifier` | *str* | :heavy_check_mark: | The identifier to be added in the block-list.
This can be an email address, a phone number or a web3 wallet. | example@example.com | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -140,15 +133,14 @@ Delete an identifier from the instance block-list ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.allowlist_blocklist.delete_blocklist_identifier(identifier_id="identifier123") +) as s: + res = s.allowlist_blocklist.delete_blocklist_identifier(identifier_id="identifier123") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/allowlistidentifiers/README.md b/docs/sdks/allowlistidentifiers/README.md index 7896e5e..41dcddb 100644 --- a/docs/sdks/allowlistidentifiers/README.md +++ b/docs/sdks/allowlistidentifiers/README.md @@ -16,15 +16,14 @@ Delete an identifier from the instance allow-list ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.allowlist_identifiers.delete(identifier_id="example_identifier_id") -res = s.allowlist_identifiers.delete(identifier_id="example_identifier_id") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/betafeatures/README.md b/docs/sdks/betafeatures/README.md index 3bc9bba..cb855ed 100644 --- a/docs/sdks/betafeatures/README.md +++ b/docs/sdks/betafeatures/README.md @@ -18,22 +18,21 @@ Updates the settings of an instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.beta_features.update_instance_settings(request={ - "restricted_to_allowlist": False, - "from_email_address": "noreply", - "progressive_sign_up": True, - "session_token_template": "defaultSessionToken", - "enhanced_email_deliverability": True, - "test_mode": True, -}) - -if res is not None: - # handle response - pass +) as s: + res = s.beta_features.update_instance_settings(request={ + "restricted_to_allowlist": False, + "from_email_address": "noreply", + "progressive_sign_up": True, + "session_token_template": "defaultSessionToken", + "enhanced_email_deliverability": True, + "test_mode": True, + }) + + if res is not None: + # handle response + pass ``` @@ -70,15 +69,14 @@ WARNING: Changing your domain will invalidate all current user sessions (i.e. us ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + s.beta_features.update_domain(request={ + "home_url": "https://www.example.com", + }) -s.beta_features.update_domain(request={ - "home_url": "https://www.example.com", -}) - -# Use the SDK ... + # Use the SDK ... ``` @@ -109,16 +107,15 @@ WARNING: Changing your domain will invalidate all current user sessions (i.e. us ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -s.beta_features.change_production_instance_domain(request={ - "home_url": "https://www.newdomain.com", - "is_secondary": False, -}) +) as s: + s.beta_features.change_production_instance_domain(request={ + "home_url": "https://www.newdomain.com", + "is_secondary": False, + }) -# Use the SDK ... + # Use the SDK ... ``` diff --git a/docs/sdks/blocklistidentifierssdk/README.md b/docs/sdks/blocklistidentifierssdk/README.md index d03b2ba..e645879 100644 --- a/docs/sdks/blocklistidentifierssdk/README.md +++ b/docs/sdks/blocklistidentifierssdk/README.md @@ -16,15 +16,14 @@ Get a list of all identifiers which are not allowed to access an instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.blocklist_identifiers.list() -res = s.blocklist_identifiers.list() - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/clerk/README.md b/docs/sdks/clerk/README.md index 1b3dc9b..3d5b315 100644 --- a/docs/sdks/clerk/README.md +++ b/docs/sdks/clerk/README.md @@ -12,4 +12,6 @@ Each version is identified by its release date, e.g. `2021-02-05`. For more info Please see https://clerk.com/docs for more information. - \ No newline at end of file + + +### Available Operations diff --git a/docs/sdks/clerkredirecturls/README.md b/docs/sdks/clerkredirecturls/README.md index aca4c82..6968828 100644 --- a/docs/sdks/clerkredirecturls/README.md +++ b/docs/sdks/clerkredirecturls/README.md @@ -18,17 +18,16 @@ Create a redirect URL ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.redirect_urls.create(request={ + "url": "https://my-app.com/oauth-callback", + }) -res = s.redirect_urls.create(request={ - "url": "https://my-app.com/oauth-callback", -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -59,15 +58,14 @@ Retrieve the details of the redirect URL with the given ID ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.redirect_urls.get(id="redir_01FG4K9G5NWSQ4ZPT4TQE4Z7G3") +) as s: + res = s.redirect_urls.get(id="redir_01FG4K9G5NWSQ4ZPT4TQE4Z7G3") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -98,15 +96,14 @@ Remove the selected redirect URL from the whitelist of the instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.redirect_urls.delete(id="redir_01FG4K9G5NWSQ4ZPT4TQE4Z7G3") +) as s: + res = s.redirect_urls.delete(id="redir_01FG4K9G5NWSQ4ZPT4TQE4Z7G3") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/clients/README.md b/docs/sdks/clients/README.md index 8165283..140e760 100644 --- a/docs/sdks/clients/README.md +++ b/docs/sdks/clients/README.md @@ -25,15 +25,14 @@ Warning: the endpoint is being deprecated and will be removed in future versions ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.clients.list(limit=20, offset=10) -res = s.clients.list(limit=20, offset=10) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -65,17 +64,16 @@ Verifies the client in the provided token ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.clients.verify(request={ - "token": "jwt_token_example", -}) +) as s: + res = s.clients.verify(request={ + "token": "jwt_token_example", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -106,15 +104,14 @@ Returns the details of a client. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.clients.get(client_id="cli_123456789") +) as s: + res = s.clients.get(client_id="cli_123456789") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/domainssdk/README.md b/docs/sdks/domainssdk/README.md index ac2b761..2ff2e73 100644 --- a/docs/sdks/domainssdk/README.md +++ b/docs/sdks/domainssdk/README.md @@ -22,15 +22,14 @@ The response will contain the primary domain for the instance and any satellite ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.domains.list() -res = s.domains.list() - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -63,28 +62,25 @@ If you're planning to configure the new satellite domain to run behind a proxy, ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.domains.add(request={ - "name": "example.com", - "is_satellite": True, - "proxy_url": "https://proxy.example.com", -}) +) as s: + res = s.domains.add(name="example.com", is_satellite=True, proxy_url="https://proxy.example.com") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `request` | [models.AddDomainRequestBody](../../models/adddomainrequestbody.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 | +| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | The new domain name. Can contain the port for development instances. | example.com | +| `is_satellite` | *bool* | :heavy_check_mark: | Marks the new domain as satellite. Only `true` is accepted at the moment. | true | +| `proxy_url` | *Optional[str]* | :heavy_minus_sign: | The full URL of the proxy which will forward requests to the Clerk Frontend API for this domain. Applicable only to production instances. | https://proxy.example.com | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -107,15 +103,14 @@ It is currently not possible to delete the instance's primary domain. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.domains.delete(domain_id="domain_12345") +) as s: + res = s.domains.delete(domain_id="domain_12345") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -153,15 +148,14 @@ update the instance's home origin, affecting the default application paths. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.domains.update(domain_id="domain_12345", name="example.com", proxy_url="http://proxy.example.com", is_secondary=False) +) as s: + res = s.domains.update(domain_id="domain_12345", name="example.com", proxy_url="http://proxy.example.com", is_secondary=False) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/emailaddresses/README.md b/docs/sdks/emailaddresses/README.md index f6d60d8..72f6c86 100644 --- a/docs/sdks/emailaddresses/README.md +++ b/docs/sdks/emailaddresses/README.md @@ -19,20 +19,19 @@ Create a new email address ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.email_addresses.create(request={ - "user_id": "user_12345", - "email_address": "example@clerk.com", - "verified": False, - "primary": True, -}) - -if res is not None: - # handle response - pass +) as s: + res = s.email_addresses.create(request={ + "user_id": "user_12345", + "email_address": "example@clerk.com", + "verified": False, + "primary": True, + }) + + if res is not None: + # handle response + pass ``` @@ -63,15 +62,14 @@ Returns the details of an email address. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.email_addresses.get(email_address_id="email_address_id_example") +) as s: + res = s.email_addresses.get(email_address_id="email_address_id_example") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -102,15 +100,14 @@ Delete the email address with the given ID ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.email_addresses.delete(email_address_id="email_address_id_example") -res = s.email_addresses.delete(email_address_id="email_address_id_example") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -141,15 +138,14 @@ Updates an email address. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.email_addresses.update(email_address_id="email_address_id_example", verified=False, primary=True) +) as s: + res = s.email_addresses.update(email_address_id="email_address_id_example", verified=False, primary=True) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/emailandsmstemplates/README.md b/docs/sdks/emailandsmstemplates/README.md index 1f4565f..e32d835 100644 --- a/docs/sdks/emailandsmstemplates/README.md +++ b/docs/sdks/emailandsmstemplates/README.md @@ -19,15 +19,14 @@ Updates the existing template of the given type and slug import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.email_and_sms_templates.upsert(template_type=clerk_backend_api.UpsertTemplatePathParamTemplateType.SMS, slug="verification-code", name="Verification Code", subject="Your Verification Code", markup="

Your code: {{code}}

", body="Use this code to verify your email: {{code}}", delivered_by_clerk=True, from_email_name="hello", reply_to_email_name="support") -res = s.email_and_sms_templates.upsert(template_type=clerk_backend_api.UpsertTemplatePathParamTemplateType.SMS, slug="verification-code", name="Verification Code", subject="Your Verification Code", markup="

Your code: {{code}}

", body="Use this code to verify your email: {{code}}", delivered_by_clerk=True, from_email_name="hello", reply_to_email_name="support") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/emailsmstemplates/README.md b/docs/sdks/emailsmstemplates/README.md index a710e25..f1af8f3 100644 --- a/docs/sdks/emailsmstemplates/README.md +++ b/docs/sdks/emailsmstemplates/README.md @@ -23,15 +23,14 @@ The templates are returned sorted by position. import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.email_sms_templates.list(template_type=clerk_backend_api.TemplateType.EMAIL) -res = s.email_sms_templates.list(template_type=clerk_backend_api.TemplateType.EMAIL) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -65,15 +64,14 @@ Reverts an updated template to its default state import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.email_sms_templates.revert(template_type=clerk_backend_api.RevertTemplatePathParamTemplateType.EMAIL, slug="welcome-email") +) as s: + res = s.email_sms_templates.revert(template_type=clerk_backend_api.RevertTemplatePathParamTemplateType.EMAIL, slug="welcome-email") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -108,15 +106,14 @@ Returns the details of a template import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.email_sms_templates.get(template_type=clerk_backend_api.PathParamTemplateType.EMAIL, slug="welcome-email") -res = s.email_sms_templates.get(template_type=clerk_backend_api.PathParamTemplateType.EMAIL, slug="welcome-email") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -153,15 +150,14 @@ The app developer will need to listen to the `email.created` or `sms.created` we import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.email_sms_templates.toggle_template_delivery(template_type=clerk_backend_api.ToggleTemplateDeliveryPathParamTemplateType.EMAIL, slug="welcome-email", delivered_by_clerk=True) +) as s: + res = s.email_sms_templates.toggle_template_delivery(template_type=clerk_backend_api.ToggleTemplateDeliveryPathParamTemplateType.EMAIL, slug="welcome-email", delivered_by_clerk=True) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/instancesettingssdk/README.md b/docs/sdks/instancesettingssdk/README.md index f4c8e43..4ad2b57 100644 --- a/docs/sdks/instancesettingssdk/README.md +++ b/docs/sdks/instancesettingssdk/README.md @@ -18,26 +18,25 @@ Updates the settings of an instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -s.instance_settings.update(request={ - "test_mode": True, - "hibp": False, - "enhanced_email_deliverability": True, - "support_email": "support@example.com", - "clerk_js_version": "2.3.1", - "development_origin": "http://localhost:3000", - "allowed_origins": [ - "http://localhost:3000", - "chrome-extension://extension_uiid", - "capacitor://localhost", - ], - "url_based_session_syncing": True, -}) - -# Use the SDK ... +) as s: + s.instance_settings.update(request={ + "test_mode": True, + "hibp": False, + "enhanced_email_deliverability": True, + "support_email": "support@example.com", + "clerk_js_version": "2.3.1", + "development_origin": "http://localhost:3000", + "allowed_origins": [ + "http://localhost:3000", + "chrome-extension://extension_uiid", + "capacitor://localhost", + ], + "url_based_session_syncing": True, + }) + + # Use the SDK ... ``` @@ -64,21 +63,20 @@ Updates the restriction settings of an instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.instance_settings.update_restrictions(request={ - "allowlist": False, - "blocklist": True, - "block_email_subaddresses": True, - "block_disposable_email_domains": True, - "ignore_dots_for_gmail_addresses": False, -}) - -if res is not None: - # handle response - pass +) as s: + res = s.instance_settings.update_restrictions(request={ + "allowlist": False, + "blocklist": True, + "block_email_subaddresses": True, + "block_disposable_email_domains": True, + "ignore_dots_for_gmail_addresses": False, + }) + + if res is not None: + # handle response + pass ``` @@ -109,26 +107,25 @@ Updates the organization settings of the instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.instance_settings.update_organization_settings(request={ - "enabled": True, - "max_allowed_memberships": 10, - "admin_delete_enabled": False, - "domains_enabled": True, - "domains_enrollment_modes": [ - "automatic_invitation", - "automatic_suggestion", - ], - "creator_role_id": "creator_role", - "domains_default_role_id": "member_role", -}) - -if res is not None: - # handle response - pass +) as s: + res = s.instance_settings.update_organization_settings(request={ + "enabled": True, + "max_allowed_memberships": 10, + "admin_delete_enabled": False, + "domains_enabled": True, + "domains_enrollment_modes": [ + "automatic_invitation", + "automatic_suggestion", + ], + "creator_role_id": "creator_role", + "domains_default_role_id": "member_role", + }) + + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/invitations/README.md b/docs/sdks/invitations/README.md index fcc8826..ec050de 100644 --- a/docs/sdks/invitations/README.md +++ b/docs/sdks/invitations/README.md @@ -23,33 +23,30 @@ Also, trying to create an invitation for an email address that already exists in ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.invitations.create(email_address="user@example.com", public_metadata={ -res = s.invitations.create(request={ - "email_address": "user@example.com", - "public_metadata": { + }, redirect_url="https://example.com/welcome", notify=True, ignore_existing=True, expires_in_days=486589) - }, - "redirect_url": "https://example.com/welcome", - "notify": True, - "ignore_existing": True, - "expires_in_days": 486589, -}) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `request` | [models.CreateInvitationRequestBody](../../models/createinvitationrequestbody.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 | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `email_address` | *str* | :heavy_check_mark: | The email address the invitation will be sent to | user@example.com | +| `public_metadata` | Dict[str, *Any*] | :heavy_minus_sign: | Metadata that will be attached to the newly created invitation.
The value of this property should be a well-formed JSON object.
Once the user accepts the invitation and signs up, these metadata will end up in the user's public metadata. | {} | +| `redirect_url` | *Optional[str]* | :heavy_minus_sign: | Optional URL which specifies where to redirect the user once they click the invitation link.
This is only required if you have implemented a [custom flow](https://clerk.com/docs/authentication/invitations#custom-flow) and you're not using Clerk Hosted Pages or Clerk Components. | https://example.com/welcome | +| `notify` | *OptionalNullable[bool]* | :heavy_minus_sign: | Optional flag which denotes whether an email invitation should be sent to the given email address.
Defaults to true. | true | +| `ignore_existing` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether an invitation should be created if there is already an existing invitation for this email address, or it's claimed by another user. | ​false | +| `expires_in_days` | *OptionalNullable[int]* | :heavy_minus_sign: | The number of days the invitation will be valid for. By default, the invitation does not expire. | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -72,15 +69,14 @@ Returns all non-revoked invitations for your application, sorted by creation dat import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.invitations.list(limit=20, offset=10, status=clerk_backend_api.ListInvitationsQueryParamStatus.PENDING) +) as s: + res = s.invitations.list(limit=20, offset=10, status=clerk_backend_api.ListInvitationsQueryParamStatus.PENDING) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -115,15 +111,14 @@ Only active (i.e. non-revoked) invitations can be revoked. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.invitations.revoke(invitation_id="inv_123") +) as s: + res = s.invitations.revoke(invitation_id="inv_123") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/jwks/README.md b/docs/sdks/jwks/README.md index 664985c..a3e50e0 100644 --- a/docs/sdks/jwks/README.md +++ b/docs/sdks/jwks/README.md @@ -16,15 +16,14 @@ Retrieve the JSON Web Key Set of the instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.jwks.get() -res = s.jwks.get() - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/jwttemplates/README.md b/docs/sdks/jwttemplates/README.md index c8a702a..782ea54 100644 --- a/docs/sdks/jwttemplates/README.md +++ b/docs/sdks/jwttemplates/README.md @@ -20,15 +20,14 @@ List all templates ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.jwt_templates.list() -res = s.jwt_templates.list() - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -57,23 +56,22 @@ Create a new JWT template ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.jwt_templates.create(request={ - "name": "Example Template", - "claims": {}, - "lifetime": 3600, - "allowed_clock_skew": 5, - "custom_signing_key": False, - "signing_algorithm": "RS256", - "signing_key": "PRIVATE_KEY_PLACEHOLDER", -}) - -if res is not None: - # handle response - pass +) as s: + res = s.jwt_templates.create(request={ + "name": "Example Template", + "claims": {}, + "lifetime": 3600, + "allowed_clock_skew": 5, + "custom_signing_key": False, + "signing_algorithm": "RS256", + "signing_key": "PRIVATE_KEY_PLACEHOLDER", + }) + + if res is not None: + # handle response + pass ``` @@ -104,15 +102,14 @@ Retrieve the details of a given JWT template ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.jwt_templates.get(template_id="template_123") +) as s: + res = s.jwt_templates.get(template_id="template_123") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -143,15 +140,14 @@ Updates an existing JWT template ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.jwt_templates.update(template_id="", name="", claims={}, lifetime=8574.77, allowed_clock_skew=5971.29, custom_signing_key=True, signing_algorithm="", signing_key="") -res = s.jwt_templates.update(template_id="", name="", claims={}, lifetime=8574.77, allowed_clock_skew=5971.29, custom_signing_key=True, signing_algorithm="", signing_key="") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -189,15 +185,14 @@ Delete a Template ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.jwt_templates.delete(template_id="") +) as s: + res = s.jwt_templates.delete(template_id="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/miscellaneous/README.md b/docs/sdks/miscellaneous/README.md index bb7c33f..ae57691 100644 --- a/docs/sdks/miscellaneous/README.md +++ b/docs/sdks/miscellaneous/README.md @@ -19,11 +19,10 @@ It is used by Clerk SDKs when the user's authentication state cannot be immediat ```python from clerk_backend_api import Clerk -s = Clerk() +with Clerk() as s: + s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d") -s.miscellaneous.get_interstitial(frontend_api="frontend-api_1a2b3c4d", publishable_key="pub_1a2b3c4d") - -# Use the SDK ... + # Use the SDK ... ``` diff --git a/docs/sdks/oauthapplicationssdk/README.md b/docs/sdks/oauthapplicationssdk/README.md index c964eeb..4b9d3ba 100644 --- a/docs/sdks/oauthapplicationssdk/README.md +++ b/docs/sdks/oauthapplicationssdk/README.md @@ -24,15 +24,14 @@ Most recent OAuth applications will be returned first. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.oauth_applications.list(limit=20, offset=10) -res = s.oauth_applications.list(limit=20, offset=10) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -66,29 +65,26 @@ All URL schemes are allowed such as `http://`, `https://`, `myapp://`, etc... ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.oauth_applications.create(request={ - "name": "Example App", - "callback_url": "https://example.com/oauth/callback", - "scopes": "profile email public_metadata", - "public": True, -}) +) as s: + res = s.oauth_applications.create(name="Example App", callback_url="https://example.com/oauth/callback", scopes="profile email public_metadata", public=True) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `request` | [models.CreateOAuthApplicationRequestBody](../../models/createoauthapplicationrequestbody.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 | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | The name of the new OAuth application | Example App | +| `callback_url` | *str* | :heavy_check_mark: | The callback URL of the new OAuth application | https://example.com/oauth/callback | +| `scopes` | *Optional[str]* | :heavy_minus_sign: | Define the allowed scopes for the new OAuth applications that dictate the user payload of the OAuth user info endpoint. Available scopes are `profile`, `email`, `public_metadata`, `private_metadata`. Provide the requested scopes as a string, separated by spaces. | profile email public_metadata | +| `public` | *Optional[bool]* | :heavy_minus_sign: | If true, this client is public and cannot securely store a client secret.
Only the authorization code flow with proof key for code exchange (PKCE) may be used.
Public clients cannot be updated to be confidential clients, and vice versa. | true | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -110,15 +106,14 @@ Fetches the OAuth application whose ID matches the provided `id` in the path. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.oauth_applications.get(oauth_application_id="oauth_app_12345") -res = s.oauth_applications.get(oauth_application_id="oauth_app_12345") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -149,15 +144,14 @@ Updates an existing OAuth application ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.oauth_applications.update(oauth_application_id="oauth_app_67890", name="Updated OAuth App Name", callback_url="https://example.com/oauth/callback", scopes="profile email public_metadata private_metadata") +) as s: + res = s.oauth_applications.update(oauth_application_id="oauth_app_67890", name="Updated OAuth App Name", callback_url="https://example.com/oauth/callback", scopes="profile email public_metadata private_metadata") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -192,15 +186,14 @@ This is not reversible. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.oauth_applications.delete(oauth_application_id="oauth_app_09876") -res = s.oauth_applications.delete(oauth_application_id="oauth_app_09876") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -232,15 +225,14 @@ When the client secret is rotated, make sure to update it in authorized OAuth cl ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.oauth_applications.rotate_secret(oauth_application_id="oauth_application_12345") +) as s: + res = s.oauth_applications.rotate_secret(oauth_application_id="oauth_application_12345") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/organizationdomainsdk/README.md b/docs/sdks/organizationdomainsdk/README.md index 8f74310..34bd16c 100644 --- a/docs/sdks/organizationdomainsdk/README.md +++ b/docs/sdks/organizationdomainsdk/README.md @@ -16,15 +16,14 @@ Updates the properties of an existing organization domain. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organization_domain.update(organization_id="", domain_id="", enrollment_mode="", verified=False) -res = s.organization_domain.update(organization_id="", domain_id="", enrollment_mode="", verified=False) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/organizationdomainssdk/README.md b/docs/sdks/organizationdomainssdk/README.md index eb384a4..ca8772b 100644 --- a/docs/sdks/organizationdomainssdk/README.md +++ b/docs/sdks/organizationdomainssdk/README.md @@ -18,15 +18,14 @@ Creates a new organization domain. By default the domain is verified, but can be ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organization_domains.create(organization_id="", name="", enrollment_mode="", verified=True) -res = s.organization_domains.create(organization_id="", name="", enrollment_mode="", verified=True) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -60,15 +59,14 @@ Get a list of all domains of an organization. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_domains.list(organization_id="", limit=20, offset=10, verified="", enrollment_mode="") +) as s: + res = s.organization_domains.list(organization_id="", limit=20, offset=10, verified="", enrollment_mode="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -103,15 +101,14 @@ Removes the given domain from the organization. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_domains.delete(organization_id="", domain_id="") +) as s: + res = s.organization_domains.delete(organization_id="", domain_id="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/organizationinvitationssdk/README.md b/docs/sdks/organizationinvitationssdk/README.md index 1a021c6..dd49c50 100644 --- a/docs/sdks/organizationinvitationssdk/README.md +++ b/docs/sdks/organizationinvitationssdk/README.md @@ -28,15 +28,14 @@ The organization invitations are ordered by descending creation date by default. import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organization_invitations.get_all(limit=20, offset=10, order_by="-created_at", status=clerk_backend_api.ListInstanceOrganizationInvitationsQueryParamStatus.ACCEPTED, query="") -res = s.organization_invitations.get_all(limit=20, offset=10, order_by="-created_at", status=clerk_backend_api.ListInstanceOrganizationInvitationsQueryParamStatus.ACCEPTED, query="") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -86,19 +85,18 @@ When the organization invitation is accepted, the metadata will be transferred t ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_invitations.create(organization_id="org_12345", email_address="user@example.com", role="admin", inviter_user_id="user_67890", public_metadata={ - "key": "value", -}, private_metadata={ - "private_key": "secret_value", -}, redirect_url="https://example.com/welcome") +) as s: + res = s.organization_invitations.create(organization_id="org_12345", email_address="user@example.com", role="admin", inviter_user_id="user_67890", public_metadata={ + "key": "value", + }, private_metadata={ + "private_key": "secret_value", + }, redirect_url="https://example.com/welcome") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -141,15 +139,14 @@ Any invitations created as a result of an Organization Domain are not included i import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_invitations.list(organization_id="org_12345", limit=20, offset=10, status=clerk_backend_api.ListOrganizationInvitationsQueryParamStatus.PENDING) +) as s: + res = s.organization_invitations.list(organization_id="org_12345", limit=20, offset=10, status=clerk_backend_api.ListOrganizationInvitationsQueryParamStatus.PENDING) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -195,28 +192,27 @@ When the organization invitation is accepted, the metadata will be transferred t ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_invitations.bulk_create(organization_id="org_12345", request_body=[ - { - "email_address": "newmember@example.com", - "role": "admin", - "inviter_user_id": "user_67890", - "public_metadata": { - +) as s: + res = s.organization_invitations.bulk_create(organization_id="org_12345", request_body=[ + { + "email_address": "newmember@example.com", + "role": "admin", + "inviter_user_id": "user_67890", + "public_metadata": { + + }, + "private_metadata": { + + }, + "redirect_url": "https://example.com/welcome", }, - "private_metadata": { + ]) - }, - "redirect_url": "https://example.com/welcome", - }, -]) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -255,15 +251,14 @@ Any invitations created as a result of an Organization Domain are not included i ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_invitations.list_pending(organization_id="org_12345", limit=20, offset=10) +) as s: + res = s.organization_invitations.list_pending(organization_id="org_12345", limit=20, offset=10) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -296,15 +291,14 @@ Use this request to get an existing organization invitation by ID. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organization_invitations.get(organization_id="org_123456789", invitation_id="inv_987654321") -res = s.organization_invitations.get(organization_id="org_123456789", invitation_id="inv_987654321") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -340,15 +334,14 @@ Only users with "admin" role can revoke invitations. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_invitations.revoke(organization_id="org_123456", invitation_id="inv_123456", requesting_user_id="usr_12345") +) as s: + res = s.organization_invitations.revoke(organization_id="org_123456", invitation_id="inv_123456", requesting_user_id="usr_12345") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/organizationmembershipssdk/README.md b/docs/sdks/organizationmembershipssdk/README.md index 05077e7..16bf9f5 100644 --- a/docs/sdks/organizationmembershipssdk/README.md +++ b/docs/sdks/organizationmembershipssdk/README.md @@ -21,15 +21,14 @@ Adds a user as a member to the given organization. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organization_memberships.create(organization_id="org_123", user_id="user_456", role="admin") -res = s.organization_memberships.create(organization_id="org_123", user_id="user_456", role="admin") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -62,15 +61,14 @@ Retrieves all user memberships for the given organization ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_memberships.list(organization_id="org_789", limit=20, offset=10, order_by="+created_at") +) as s: + res = s.organization_memberships.list(organization_id="org_789", limit=20, offset=10, order_by="+created_at") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -104,15 +102,14 @@ Updates the properties of an existing organization membership ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_memberships.update(organization_id="org_12345", user_id="user_67890", role="admin") +) as s: + res = s.organization_memberships.update(organization_id="org_12345", user_id="user_67890", role="admin") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -145,15 +142,14 @@ Removes the given membership from the organization ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organization_memberships.delete(organization_id="org_12345", user_id="user_67890") -res = s.organization_memberships.delete(organization_id="org_12345", user_id="user_67890") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -187,19 +183,18 @@ You can remove metadata keys at any level by setting their value to `null`. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_memberships.update_metadata(organization_id="org_123456", user_id="user_654321", public_metadata={ +) as s: + res = s.organization_memberships.update_metadata(organization_id="org_123456", user_id="user_654321", public_metadata={ -}, private_metadata={ + }, private_metadata={ -}) + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -233,15 +228,14 @@ Retrieves all organization user memberships for the given instance. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organization_memberships.get_all(limit=20, offset=10, order_by="") +) as s: + res = s.organization_memberships.get_all(limit=20, offset=10, order_by="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/organizationssdk/README.md b/docs/sdks/organizationssdk/README.md index 470aa3b..337ec40 100644 --- a/docs/sdks/organizationssdk/README.md +++ b/docs/sdks/organizationssdk/README.md @@ -29,15 +29,14 @@ Most recent organizations will be returned first. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organizations.list(limit=20, offset=10, include_members_count=False, query="clerk", order_by="-name") -res = s.organizations.list(limit=20, offset=10, include_members_count=False, query="clerk", order_by="-name") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -82,36 +81,33 @@ the next time they create a session, presuming they don't explicitly set a diffe ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organizations.create(request={ - "name": "NewOrg", - "created_by": "user_123", - "private_metadata": { +) as s: + res = s.organizations.create(name="NewOrg", created_by="user_123", private_metadata={ "internal_code": "ABC123", - }, - "public_metadata": { + }, public_metadata={ "public_event": "Annual Summit", - }, - "slug": "neworg", - "max_allowed_memberships": 100, - "created_at": "", -}) + }, slug="neworg", max_allowed_memberships=100, created_at="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `request` | [models.CreateOrganizationRequestBody](../../models/createorganizationrequestbody.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 | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | The name of the new organization.
May not contain URLs or HTML. | NewOrg | +| `created_by` | *str* | :heavy_check_mark: | The ID of the User who will become the administrator for the new organization | user_123 | +| `private_metadata` | Dict[str, *Any*] | :heavy_minus_sign: | Metadata saved on the organization, accessible only from the Backend API | {
"internal_code": "ABC123"
} | +| `public_metadata` | Dict[str, *Any*] | :heavy_minus_sign: | Metadata saved on the organization, read-only from the Frontend API and fully accessible (read/write) from the Backend API | {
"public_event": "Annual Summit"
} | +| `slug` | *Optional[str]* | :heavy_minus_sign: | A slug for the new organization.
Can contain only lowercase alphanumeric characters and the dash "-".
Must be unique for the instance. | neworg | +| `max_allowed_memberships` | *Optional[int]* | :heavy_minus_sign: | The maximum number of memberships allowed for this organization | 100 | +| `created_at` | *Optional[str]* | :heavy_minus_sign: | A custom date/time denoting _when_ the organization was created, specified in RFC3339 format (e.g. `2012-10-20T07: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 @@ -133,15 +129,14 @@ Fetches the organization whose ID or slug matches the provided `id_or_slug` URL ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organizations.get(organization_id="org_123", include_members_count=False) -res = s.organizations.get(organization_id="org_123", include_members_count=False) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -173,19 +168,18 @@ Updates an existing organization ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organizations.update(organization_id="org_123_update", public_metadata={ +) as s: + res = s.organizations.update(organization_id="org_123_update", public_metadata={ -}, private_metadata={ + }, private_metadata={ -}, name="New Organization Name", slug="new-org-slug", max_allowed_memberships=100, admin_delete_enabled=True, created_at="") + }, name="New Organization Name", slug="new-org-slug", max_allowed_memberships=100, admin_delete_enabled=True, created_at="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -225,15 +219,14 @@ This is not reversible. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organizations.delete(organization_id="org_321_delete") -res = s.organizations.delete(organization_id="org_321_delete") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -267,19 +260,18 @@ You can remove metadata keys at any level by setting their value to `null`. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organizations.merge_metadata(organization_id="org_12345", public_metadata={ - "announcement": "We are opening a new office!", -}, private_metadata={ - "internal_use_only": "Future plans discussion.", -}) +) as s: + res = s.organizations.merge_metadata(organization_id="org_12345", public_metadata={ + "announcement": "We are opening a new office!", + }, private_metadata={ + "internal_use_only": "Future plans discussion.", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -315,19 +307,18 @@ Only the following file content types are supported: `image/jpeg`, `image/png`, ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.organizations.upload_logo(organization_id="org_12345", file={ + "file_name": "example.file", + "content": open("example.file", "rb"), + "content_type": "", + }, uploader_user_id="user_67890") -res = s.organizations.upload_logo(organization_id="org_12345", file={ - "file_name": "example.file", - "content": open("example.file", "rb"), - "content_type": "", -}, uploader_user_id="user_67890") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -360,15 +351,14 @@ Delete the organization's logo. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.organizations.delete_logo(organization_id="org_12345") +) as s: + res = s.organizations.delete_logo(organization_id="org_12345") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/phonenumbers/README.md b/docs/sdks/phonenumbers/README.md index 7fa5c2c..a1d258a 100644 --- a/docs/sdks/phonenumbers/README.md +++ b/docs/sdks/phonenumbers/README.md @@ -19,21 +19,20 @@ Create a new phone number ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.phone_numbers.create(request={ - "user_id": "usr_12345", - "phone_number": "+11234567890", - "verified": True, - "primary": False, - "reserved_for_second_factor": False, -}) - -if res is not None: - # handle response - pass +) as s: + res = s.phone_numbers.create(request={ + "user_id": "usr_12345", + "phone_number": "+11234567890", + "verified": True, + "primary": False, + "reserved_for_second_factor": False, + }) + + if res is not None: + # handle response + pass ``` @@ -64,15 +63,14 @@ Returns the details of a phone number ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.phone_numbers.get(phone_number_id="phone_12345") +) as s: + res = s.phone_numbers.get(phone_number_id="phone_12345") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -103,15 +101,14 @@ Delete the phone number with the given ID ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.phone_numbers.delete(phone_number_id="phone_12345") -res = s.phone_numbers.delete(phone_number_id="phone_12345") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -142,15 +139,14 @@ Updates a phone number ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.phone_numbers.update(phone_number_id="phone_12345", verified=False, primary=True, reserved_for_second_factor=True) +) as s: + res = s.phone_numbers.update(phone_number_id="phone_12345", verified=False, primary=True, reserved_for_second_factor=True) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/proxychecks/README.md b/docs/sdks/proxychecks/README.md index 3e4d1a0..98aac25 100644 --- a/docs/sdks/proxychecks/README.md +++ b/docs/sdks/proxychecks/README.md @@ -23,18 +23,17 @@ a different proxy URL than the one provided. It can also be used to re-validate ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.proxy_checks.verify(request={ - "domain_id": "domain_32hfu3e", - "proxy_url": "https://example.com/__clerk", -}) - -if res is not None: - # handle response - pass +) as s: + res = s.proxy_checks.verify(request={ + "domain_id": "domain_32hfu3e", + "proxy_url": "https://example.com/__clerk", + }) + + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/redirecturls/README.md b/docs/sdks/redirecturls/README.md index 05e168b..fa67358 100644 --- a/docs/sdks/redirecturls/README.md +++ b/docs/sdks/redirecturls/README.md @@ -16,15 +16,14 @@ Lists all whitelisted redirect_urls for the instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.redirect_ur_ls.list() -res = s.redirect_ur_ls.list() - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/samlconnectionssdk/README.md b/docs/sdks/samlconnectionssdk/README.md index 92fb4fa..7e7e4a8 100644 --- a/docs/sdks/samlconnectionssdk/README.md +++ b/docs/sdks/samlconnectionssdk/README.md @@ -22,15 +22,14 @@ The SAML Connections are ordered by descending creation date and the most recent ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.saml_connections.list(limit=20, offset=10) -res = s.saml_connections.list(limit=20, offset=10) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -63,39 +62,36 @@ Create a new SAML Connection. import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.saml_connections.create(request={ - "name": "My SAML Connection", - "domain": "example.org", - "provider": clerk_backend_api.Provider.SAML_CUSTOM, - "idp_entity_id": "http://idp.example.org/", - "idp_sso_url": "http://idp.example.org/sso", - "idp_certificate": "MIIDdzCCAl+gAwIBAgIJAKcyBaiiz+DT...", - "idp_metadata_url": "http://idp.example.org/metadata.xml", - "idp_metadata": "", - "skip_legal_checks": False, - "create_organization_enabled": True, - "create_organizations_limit": 134365, - "created_at": "2023-03-15T07:15:20.902Z", -}) - -if res is not None: - # handle response - pass + "unsafe_metadata": { + "preferences": { + "theme": "dark", + }, + }, + "delete_self_enabled": True, + "legal_accepted_at": "", + "skip_legal_checks": False, + "create_organization_enabled": True, + "create_organizations_limit": 134365, + "created_at": "2023-03-15T07:15:20.902Z", + }) + + if res is not None: + # handle response + pass ``` @@ -194,27 +192,26 @@ Returns a total count of all users that match the given filtering criteria. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.count(email_address=[ - "user@example.com", -], phone_number=[ - "+1234567890", -], external_id=[ - "external-id-123", -], username=[ - "username123", -], web3_wallet=[ - "0x123456789abcdef", -], user_id=[ - "user-id-123", -], query="John Doe") - -if res is not None: - # handle response - pass +) as s: + res = s.users.count(email_address=[ + "user@example.com", + ], phone_number=[ + "+1234567890", + ], external_id=[ + "external-id-123", + ], username=[ + "username123", + ], web3_wallet=[ + "0x123456789abcdef", + ], user_id=[ + "user-id-123", + ], query="John Doe") + + if res is not None: + # handle response + pass ``` @@ -251,15 +248,14 @@ Retrieve the details of a user ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.get(user_id="usr_1") +) as s: + res = s.users.get(user_id="usr_1") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -301,24 +297,23 @@ You can also choose to sign the user out of all their active sessions on any dev ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.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="argon2i", skip_password_checks=False, sign_out_of_other_sessions=True, totp_secret="ABCD1234EFGH5678", backup_codes=[ - "123456", - "654321", -], public_metadata={ - "theme": "dark", -}, private_metadata={ - "vip": True, -}, unsafe_metadata={ - "age": 30, -}, delete_self_enabled=True, create_organization_enabled=False, legal_accepted_at="", skip_legal_checks=False, create_organizations_limit=597129, created_at="2021-04-05T14:30:00.000Z") - -if res is not None: - # handle response - pass +) as s: + res = s.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="argon2i", skip_password_checks=False, sign_out_of_other_sessions=True, totp_secret="ABCD1234EFGH5678", backup_codes=[ + "123456", + "654321", + ], public_metadata={ + "theme": "dark", + }, private_metadata={ + "vip": True, + }, unsafe_metadata={ + "age": 30, + }, delete_self_enabled=True, create_organization_enabled=False, legal_accepted_at="", skip_legal_checks=False, create_organizations_limit=597129, created_at="2021-04-05T14:30:00.000Z") + + if res is not None: + # handle response + pass ``` @@ -374,15 +369,14 @@ Delete the specified user ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.users.delete(user_id="usr_1") -res = s.users.delete(user_id="usr_1") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -413,15 +407,14 @@ Marks the given user as banned, which means that all their sessions are revoked ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.ban(user_id="user_12345") +) as s: + res = s.users.ban(user_id="user_12345") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -452,15 +445,14 @@ Removes the ban mark from the given user. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.users.unban(user_id="user_12345") -res = s.users.unban(user_id="user_12345") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -492,15 +484,14 @@ Lock duration can be configured in the instance's restrictions settings. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.lock(user_id="user_123456789") +) as s: + res = s.users.lock(user_id="user_123456789") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -531,15 +522,14 @@ Removes the lock from the given user. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.users.unlock(user_id="user_12345") -res = s.users.unlock(user_id="user_12345") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -570,19 +560,18 @@ Update a user's profile image ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.set_profile_image(user_id="usr_test123", file={ - "file_name": "example.file", - "content": open("example.file", "rb"), - "content_type": "", -}) +) as s: + res = s.users.set_profile_image(user_id="usr_test123", file={ + "file_name": "example.file", + "content": open("example.file", "rb"), + "content_type": "", + }) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -614,15 +603,14 @@ Delete a user's profile image ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.users.delete_profile_image(user_id="usr_test123") -res = s.users.delete_profile_image(user_id="usr_test123") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -660,24 +648,23 @@ You can remove metadata keys at any level by setting their value to `null`. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.update_metadata(user_id="user_123456789", public_metadata={ - "key": "", - "key1": "", -}, private_metadata={ - "key": "", - "key1": "", -}, unsafe_metadata={ - "key": "", - "key1": "", -}) - -if res is not None: - # handle response - pass +) as s: + res = s.users.update_metadata(user_id="user_123456789", public_metadata={ + "key": "", + "key1": "", + }, private_metadata={ + "key": "", + "key1": "", + }, unsafe_metadata={ + "key": "", + "key1": "", + }) + + if res is not None: + # handle response + pass ``` @@ -712,15 +699,14 @@ For OAuth 2.0, if the access token has expired and we have a corresponding refre ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.get_o_auth_access_token(user_id="user_123", provider="oauth_google") +) as s: + res = s.users.get_o_auth_access_token(user_id="user_123", provider="oauth_google") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -752,15 +738,14 @@ Retrieve a paginated list of the user's organization memberships ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.users.get_organization_memberships(user_id="usr_1234567890", limit=20, offset=10) -res = s.users.get_organization_memberships(user_id="usr_1234567890", limit=20, offset=10) - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -794,15 +779,14 @@ Retrieve a paginated list of the user's organization invitations import clerk_backend_api from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.get_organization_invitations(user_id="", limit=20, offset=10, status=clerk_backend_api.UsersGetOrganizationInvitationsQueryParamStatus.PENDING) +) as s: + res = s.users.get_organization_invitations(user_id="", limit=20, offset=10, status=clerk_backend_api.UsersGetOrganizationInvitationsQueryParamStatus.PENDING) -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -837,15 +821,14 @@ Useful for custom auth flows and re-verification. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.users.verify_password(user_id="user_123", password="securepassword123") -res = s.users.verify_password(user_id="user_123", password="securepassword123") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -880,15 +863,14 @@ Useful for custom auth flows and re-verification. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.verify_totp(user_id="usr_1a2b3c", code="123456") +) as s: + res = s.users.verify_totp(user_id="usr_1a2b3c", code="123456") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -920,15 +902,14 @@ Disable all of a user's MFA methods (e.g. OTP sent via SMS, TOTP on their authen ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.users.disable_mfa(user_id="user_123456") -res = s.users.disable_mfa(user_id="user_123456") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -959,15 +940,14 @@ Disable all of a user's backup codes. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.delete_backup_codes(user_id="") +) as s: + res = s.users.delete_backup_codes(user_id="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -998,15 +978,14 @@ Delete the passkey identification for a given user and notify them through email ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.users.delete_passkey(user_id="", passkey_identification_id="") -res = s.users.delete_passkey(user_id="", passkey_identification_id="") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -1038,15 +1017,14 @@ Delete the web3 wallet identification for a given user. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.delete_web3_wallet(user_id="", web3_wallet_identification_id="") +) as s: + res = s.users.delete_web3_wallet(user_id="", web3_wallet_identification_id="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -1079,15 +1057,14 @@ Creates a TOTP (Time-based One-Time Password) for a given user, returning both t ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.users.create_totp(user_id="") -res = s.users.create_totp(user_id="") - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -1118,15 +1095,14 @@ Deletes all of the user's TOTPs. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.delete_totp(user_id="") +) as s: + res = s.users.delete_totp(user_id="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -1157,15 +1133,14 @@ Delete an external account by ID. ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.users.delete_external_account(user_id="", external_account_id="") +) as s: + res = s.users.delete_external_account(user_id="", external_account_id="") -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/docs/sdks/webhooks/README.md b/docs/sdks/webhooks/README.md index 1e9b96f..feff425 100644 --- a/docs/sdks/webhooks/README.md +++ b/docs/sdks/webhooks/README.md @@ -21,15 +21,14 @@ Create a Svix app and associate it with the current instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) +) as s: + res = s.webhooks.create_svix_app() -res = s.webhooks.create_svix_app() - -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` @@ -59,13 +58,12 @@ Delete a Svix app and disassociate it from the current instance ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -s.webhooks.delete_svix_app() +) as s: + s.webhooks.delete_svix_app() -# Use the SDK ... + # Use the SDK ... ``` @@ -91,15 +89,14 @@ Generate a new url for accessing the Svix's management dashboard for that partic ```python from clerk_backend_api import Clerk -s = Clerk( +with Clerk( bearer_auth="", -) - -res = s.webhooks.generate_svix_auth_url() +) as s: + res = s.webhooks.generate_svix_auth_url() -if res is not None: - # handle response - pass + if res is not None: + # handle response + pass ``` diff --git a/poetry.lock b/poetry.lock index 3a41550..653304c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -363,47 +363,53 @@ files = [ [[package]] name = "mypy" -version = "1.10.1" +version = "1.13.0" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.10.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e36f229acfe250dc660790840916eb49726c928e8ce10fbdf90715090fe4ae02"}, - {file = "mypy-1.10.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:51a46974340baaa4145363b9e051812a2446cf583dfaeba124af966fa44593f7"}, - {file = "mypy-1.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:901c89c2d67bba57aaaca91ccdb659aa3a312de67f23b9dfb059727cce2e2e0a"}, - {file = "mypy-1.10.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0cd62192a4a32b77ceb31272d9e74d23cd88c8060c34d1d3622db3267679a5d9"}, - {file = "mypy-1.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:a2cbc68cb9e943ac0814c13e2452d2046c2f2b23ff0278e26599224cf164e78d"}, - {file = "mypy-1.10.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:bd6f629b67bb43dc0d9211ee98b96d8dabc97b1ad38b9b25f5e4c4d7569a0c6a"}, - {file = "mypy-1.10.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a1bbb3a6f5ff319d2b9d40b4080d46cd639abe3516d5a62c070cf0114a457d84"}, - {file = "mypy-1.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8edd4e9bbbc9d7b79502eb9592cab808585516ae1bcc1446eb9122656c6066f"}, - {file = "mypy-1.10.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:6166a88b15f1759f94a46fa474c7b1b05d134b1b61fca627dd7335454cc9aa6b"}, - {file = "mypy-1.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:5bb9cd11c01c8606a9d0b83ffa91d0b236a0e91bc4126d9ba9ce62906ada868e"}, - {file = "mypy-1.10.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d8681909f7b44d0b7b86e653ca152d6dff0eb5eb41694e163c6092124f8246d7"}, - {file = "mypy-1.10.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:378c03f53f10bbdd55ca94e46ec3ba255279706a6aacaecac52ad248f98205d3"}, - {file = "mypy-1.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6bacf8f3a3d7d849f40ca6caea5c055122efe70e81480c8328ad29c55c69e93e"}, - {file = "mypy-1.10.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:701b5f71413f1e9855566a34d6e9d12624e9e0a8818a5704d74d6b0402e66c04"}, - {file = "mypy-1.10.1-cp312-cp312-win_amd64.whl", hash = "sha256:3c4c2992f6ea46ff7fce0072642cfb62af7a2484efe69017ed8b095f7b39ef31"}, - {file = "mypy-1.10.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:604282c886497645ffb87b8f35a57ec773a4a2721161e709a4422c1636ddde5c"}, - {file = "mypy-1.10.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37fd87cab83f09842653f08de066ee68f1182b9b5282e4634cdb4b407266bade"}, - {file = "mypy-1.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8addf6313777dbb92e9564c5d32ec122bf2c6c39d683ea64de6a1fd98b90fe37"}, - {file = "mypy-1.10.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5cc3ca0a244eb9a5249c7c583ad9a7e881aa5d7b73c35652296ddcdb33b2b9c7"}, - {file = "mypy-1.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:1b3a2ffce52cc4dbaeee4df762f20a2905aa171ef157b82192f2e2f368eec05d"}, - {file = "mypy-1.10.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:fe85ed6836165d52ae8b88f99527d3d1b2362e0cb90b005409b8bed90e9059b3"}, - {file = "mypy-1.10.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c2ae450d60d7d020d67ab440c6e3fae375809988119817214440033f26ddf7bf"}, - {file = "mypy-1.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6be84c06e6abd72f960ba9a71561c14137a583093ffcf9bbfaf5e613d63fa531"}, - {file = "mypy-1.10.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:2189ff1e39db399f08205e22a797383613ce1cb0cb3b13d8bcf0170e45b96cc3"}, - {file = "mypy-1.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:97a131ee36ac37ce9581f4220311247ab6cba896b4395b9c87af0675a13a755f"}, - {file = "mypy-1.10.1-py3-none-any.whl", hash = "sha256:71d8ac0b906354ebda8ef1673e5fde785936ac1f29ff6987c7483cfbd5a4235a"}, - {file = "mypy-1.10.1.tar.gz", hash = "sha256:1f8f492d7db9e3593ef42d4f115f04e556130f2819ad33ab84551403e97dd4c0"}, + {file = "mypy-1.13.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6607e0f1dd1fb7f0aca14d936d13fd19eba5e17e1cd2a14f808fa5f8f6d8f60a"}, + {file = "mypy-1.13.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8a21be69bd26fa81b1f80a61ee7ab05b076c674d9b18fb56239d72e21d9f4c80"}, + {file = "mypy-1.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7b2353a44d2179846a096e25691d54d59904559f4232519d420d64da6828a3a7"}, + {file = "mypy-1.13.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0730d1c6a2739d4511dc4253f8274cdd140c55c32dfb0a4cf8b7a43f40abfa6f"}, + {file = "mypy-1.13.0-cp310-cp310-win_amd64.whl", hash = "sha256:c5fc54dbb712ff5e5a0fca797e6e0aa25726c7e72c6a5850cfd2adbc1eb0a372"}, + {file = "mypy-1.13.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:581665e6f3a8a9078f28d5502f4c334c0c8d802ef55ea0e7276a6e409bc0d82d"}, + {file = "mypy-1.13.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3ddb5b9bf82e05cc9a627e84707b528e5c7caaa1c55c69e175abb15a761cec2d"}, + {file = "mypy-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:20c7ee0bc0d5a9595c46f38beb04201f2620065a93755704e141fcac9f59db2b"}, + {file = "mypy-1.13.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3790ded76f0b34bc9c8ba4def8f919dd6a46db0f5a6610fb994fe8efdd447f73"}, + {file = "mypy-1.13.0-cp311-cp311-win_amd64.whl", hash = "sha256:51f869f4b6b538229c1d1bcc1dd7d119817206e2bc54e8e374b3dfa202defcca"}, + {file = "mypy-1.13.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5c7051a3461ae84dfb5dd15eff5094640c61c5f22257c8b766794e6dd85e72d5"}, + {file = "mypy-1.13.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:39bb21c69a5d6342f4ce526e4584bc5c197fd20a60d14a8624d8743fffb9472e"}, + {file = "mypy-1.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:164f28cb9d6367439031f4c81e84d3ccaa1e19232d9d05d37cb0bd880d3f93c2"}, + {file = "mypy-1.13.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a4c1bfcdbce96ff5d96fc9b08e3831acb30dc44ab02671eca5953eadad07d6d0"}, + {file = "mypy-1.13.0-cp312-cp312-win_amd64.whl", hash = "sha256:a0affb3a79a256b4183ba09811e3577c5163ed06685e4d4b46429a271ba174d2"}, + {file = "mypy-1.13.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a7b44178c9760ce1a43f544e595d35ed61ac2c3de306599fa59b38a6048e1aa7"}, + {file = "mypy-1.13.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5d5092efb8516d08440e36626f0153b5006d4088c1d663d88bf79625af3d1d62"}, + {file = "mypy-1.13.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:de2904956dac40ced10931ac967ae63c5089bd498542194b436eb097a9f77bc8"}, + {file = "mypy-1.13.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:7bfd8836970d33c2105562650656b6846149374dc8ed77d98424b40b09340ba7"}, + {file = "mypy-1.13.0-cp313-cp313-win_amd64.whl", hash = "sha256:9f73dba9ec77acb86457a8fc04b5239822df0c14a082564737833d2963677dbc"}, + {file = "mypy-1.13.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:100fac22ce82925f676a734af0db922ecfea991e1d7ec0ceb1e115ebe501301a"}, + {file = "mypy-1.13.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7bcb0bb7f42a978bb323a7c88f1081d1b5dee77ca86f4100735a6f541299d8fb"}, + {file = "mypy-1.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bde31fc887c213e223bbfc34328070996061b0833b0a4cfec53745ed61f3519b"}, + {file = "mypy-1.13.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:07de989f89786f62b937851295ed62e51774722e5444a27cecca993fc3f9cd74"}, + {file = "mypy-1.13.0-cp38-cp38-win_amd64.whl", hash = "sha256:4bde84334fbe19bad704b3f5b78c4abd35ff1026f8ba72b29de70dda0916beb6"}, + {file = "mypy-1.13.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:0246bcb1b5de7f08f2826451abd947bf656945209b140d16ed317f65a17dc7dc"}, + {file = "mypy-1.13.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:7f5b7deae912cf8b77e990b9280f170381fdfbddf61b4ef80927edd813163732"}, + {file = "mypy-1.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7029881ec6ffb8bc233a4fa364736789582c738217b133f1b55967115288a2bc"}, + {file = "mypy-1.13.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:3e38b980e5681f28f033f3be86b099a247b13c491f14bb8b1e1e134d23bb599d"}, + {file = "mypy-1.13.0-cp39-cp39-win_amd64.whl", hash = "sha256:a6789be98a2017c912ae6ccb77ea553bbaf13d27605d2ca20a76dfbced631b24"}, + {file = "mypy-1.13.0-py3-none-any.whl", hash = "sha256:9c250883f9fd81d212e0952c92dbfcc96fc237f4b7c92f56ac81fd48460b3e5a"}, + {file = "mypy-1.13.0.tar.gz", hash = "sha256:0291a61b6fbf3e6673e3405cfcc0e7650bebc7939659fdca2702958038bd835e"}, ] [package.dependencies] mypy-extensions = ">=1.0.0" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typing-extensions = ">=4.1.0" +typing-extensions = ">=4.6.0" [package.extras] dmypy = ["psutil (>=4.0)"] +faster-cache = ["orjson"] install-types = ["pip"] mypyc = ["setuptools (>=50)"] reports = ["lxml"] @@ -763,4 +769,4 @@ typing-extensions = ">=3.7.4" [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "6139726ec7229bee41c32b1488756e4d5fcbd72f81f0a1eb839ad4e13eedcc43" +content-hash = "5544ab56167d3935588ec93c596d2ac500ef0f733757b02151a7a4e993f0c3d2" diff --git a/pyproject.toml b/pyproject.toml index 9cd76b3..fe653b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "clerk-backend-api" -version = "1.3.1" +version = "1.4.0" description = "Python Client SDK for clerk.dev" authors = ["Clerk",] readme = "README-PYPI.md" @@ -28,7 +28,7 @@ python-dateutil = "^2.8.2" typing-inspect = "^0.9.0" [tool.poetry.group.dev.dependencies] -mypy = "==1.10.1" +mypy = "==1.13.0" pylint = "==3.2.3" pytest = "^8.3.3" types-python-dateutil = "^2.9.0.20240316" diff --git a/src/clerk_backend_api/_version.py b/src/clerk_backend_api/_version.py index d8b3bff..8711e24 100644 --- a/src/clerk_backend_api/_version.py +++ b/src/clerk_backend_api/_version.py @@ -3,7 +3,7 @@ import importlib.metadata __title__: str = "clerk-backend-api" -__version__: str = "1.3.1" +__version__: str = "1.4.0" try: if __package__ is not None: diff --git a/src/clerk_backend_api/actortokens.py b/src/clerk_backend_api/actortokens.py index 810c9db..19eb9ac 100644 --- a/src/clerk_backend_api/actortokens.py +++ b/src/clerk_backend_api/actortokens.py @@ -3,20 +3,20 @@ from .basesdk import BaseSDK from clerk_backend_api import models, utils from clerk_backend_api._hooks import HookContext -from clerk_backend_api.types import BaseModel, OptionalNullable, UNSET -from typing import Any, Optional, Union, cast +from clerk_backend_api.types import OptionalNullable, UNSET +from typing import Any, Optional, Union class ActorTokens(BaseSDK): def create( self, *, - request: Optional[ - Union[ - models.CreateActorTokenRequestBody, - models.CreateActorTokenRequestBodyTypedDict, - ] - ] = None, + user_id: str, + actor: Union[ + models.CreateActorTokenActor, models.CreateActorTokenActorTypedDict + ], + expires_in_seconds: Optional[int] = 3600, + session_max_duration_in_seconds: Optional[int] = 1800, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -26,7 +26,10 @@ def create( Create an actor token that can be used to impersonate the given user. The `actor` parameter needs to include at least a \"sub\" key whose value is the ID of the actor (impersonating) user. - :param request: The request object to send. + :param user_id: The ID of the user being impersonated. + :param actor: The actor payload. It needs to include a sub property which should contain the ID of the actor. This whole payload will be also included in the JWT session token. + :param expires_in_seconds: Optional parameter to specify the life duration of the actor token in seconds. By default, the duration is 1 hour. + :param session_max_duration_in_seconds: The maximum duration that the session which will be created by the generated actor token should last. By default, the duration of a session created via an actor token, lasts 30 minutes. :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 @@ -39,11 +42,12 @@ def create( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateActorTokenRequestBody] - ) - request = cast(Optional[models.CreateActorTokenRequestBody], request) + request = models.CreateActorTokenRequestBody( + user_id=user_id, + actor=utils.get_pydantic_model(actor, models.CreateActorTokenActor), + expires_in_seconds=expires_in_seconds, + session_max_duration_in_seconds=session_max_duration_in_seconds, + ) req = self.build_request( method="POST", @@ -51,18 +55,14 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateActorTokenRequestBody], + request, False, False, "json", models.CreateActorTokenRequestBody ), timeout_ms=timeout_ms, ) @@ -110,12 +110,12 @@ def create( async def create_async( self, *, - request: Optional[ - Union[ - models.CreateActorTokenRequestBody, - models.CreateActorTokenRequestBodyTypedDict, - ] - ] = None, + user_id: str, + actor: Union[ + models.CreateActorTokenActor, models.CreateActorTokenActorTypedDict + ], + expires_in_seconds: Optional[int] = 3600, + session_max_duration_in_seconds: Optional[int] = 1800, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -125,7 +125,10 @@ async def create_async( Create an actor token that can be used to impersonate the given user. The `actor` parameter needs to include at least a \"sub\" key whose value is the ID of the actor (impersonating) user. - :param request: The request object to send. + :param user_id: The ID of the user being impersonated. + :param actor: The actor payload. It needs to include a sub property which should contain the ID of the actor. This whole payload will be also included in the JWT session token. + :param expires_in_seconds: Optional parameter to specify the life duration of the actor token in seconds. By default, the duration is 1 hour. + :param session_max_duration_in_seconds: The maximum duration that the session which will be created by the generated actor token should last. By default, the duration of a session created via an actor token, lasts 30 minutes. :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 @@ -138,11 +141,12 @@ async def create_async( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateActorTokenRequestBody] - ) - request = cast(Optional[models.CreateActorTokenRequestBody], request) + request = models.CreateActorTokenRequestBody( + user_id=user_id, + actor=utils.get_pydantic_model(actor, models.CreateActorTokenActor), + expires_in_seconds=expires_in_seconds, + session_max_duration_in_seconds=session_max_duration_in_seconds, + ) req = self.build_request_async( method="POST", @@ -150,18 +154,14 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateActorTokenRequestBody], + request, False, False, "json", models.CreateActorTokenRequestBody ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/allowlistblocklist.py b/src/clerk_backend_api/allowlistblocklist.py index c07cbc2..a576b14 100644 --- a/src/clerk_backend_api/allowlistblocklist.py +++ b/src/clerk_backend_api/allowlistblocklist.py @@ -3,8 +3,8 @@ from .basesdk import BaseSDK from clerk_backend_api import models, utils from clerk_backend_api._hooks import HookContext -from clerk_backend_api.types import BaseModel, OptionalNullable, UNSET -from typing import Any, List, Optional, Union, cast +from clerk_backend_api.types import OptionalNullable, UNSET +from typing import Any, List, Optional class AllowlistBlocklist(BaseSDK): @@ -169,12 +169,8 @@ async def list_allowlist_identifiers_async( def create_allowlist_identifier( self, *, - request: Optional[ - Union[ - models.CreateAllowlistIdentifierRequestBody, - models.CreateAllowlistIdentifierRequestBodyTypedDict, - ] - ] = None, + identifier: str, + notify: Optional[bool] = False, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -183,7 +179,8 @@ def create_allowlist_identifier( Create an identifier allowed to sign up to an instance - :param request: The request object to send. + :param identifier: The identifier to be added in the allow-list. This can be an email address, a phone number or a web3 wallet. + :param notify: This flag denotes whether the given identifier will receive an invitation to join the application. Note that this only works for email address and phone number identifiers. :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 @@ -196,11 +193,10 @@ def create_allowlist_identifier( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateAllowlistIdentifierRequestBody] - ) - request = cast(Optional[models.CreateAllowlistIdentifierRequestBody], request) + request = models.CreateAllowlistIdentifierRequestBody( + identifier=identifier, + notify=notify, + ) req = self.build_request( method="POST", @@ -208,7 +204,7 @@ def create_allowlist_identifier( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -217,9 +213,9 @@ def create_allowlist_identifier( get_serialized_body=lambda: utils.serialize_request_body( request, False, - True, + False, "json", - Optional[models.CreateAllowlistIdentifierRequestBody], + models.CreateAllowlistIdentifierRequestBody, ), timeout_ms=timeout_ms, ) @@ -269,12 +265,8 @@ def create_allowlist_identifier( async def create_allowlist_identifier_async( self, *, - request: Optional[ - Union[ - models.CreateAllowlistIdentifierRequestBody, - models.CreateAllowlistIdentifierRequestBodyTypedDict, - ] - ] = None, + identifier: str, + notify: Optional[bool] = False, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -283,7 +275,8 @@ async def create_allowlist_identifier_async( Create an identifier allowed to sign up to an instance - :param request: The request object to send. + :param identifier: The identifier to be added in the allow-list. This can be an email address, a phone number or a web3 wallet. + :param notify: This flag denotes whether the given identifier will receive an invitation to join the application. Note that this only works for email address and phone number identifiers. :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 @@ -296,11 +289,10 @@ async def create_allowlist_identifier_async( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateAllowlistIdentifierRequestBody] - ) - request = cast(Optional[models.CreateAllowlistIdentifierRequestBody], request) + request = models.CreateAllowlistIdentifierRequestBody( + identifier=identifier, + notify=notify, + ) req = self.build_request_async( method="POST", @@ -308,7 +300,7 @@ async def create_allowlist_identifier_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -317,9 +309,9 @@ async def create_allowlist_identifier_async( get_serialized_body=lambda: utils.serialize_request_body( request, False, - True, + False, "json", - Optional[models.CreateAllowlistIdentifierRequestBody], + models.CreateAllowlistIdentifierRequestBody, ), timeout_ms=timeout_ms, ) @@ -369,12 +361,7 @@ async def create_allowlist_identifier_async( def create_blocklist_identifier( self, *, - request: Optional[ - Union[ - models.CreateBlocklistIdentifierRequestBody, - models.CreateBlocklistIdentifierRequestBodyTypedDict, - ] - ] = None, + identifier: str, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -383,7 +370,7 @@ def create_blocklist_identifier( Create an identifier that is blocked from accessing an instance - :param request: The request object to send. + :param identifier: The identifier to be added in the block-list. This can be an email address, a phone number or a web3 wallet. :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 @@ -396,11 +383,9 @@ def create_blocklist_identifier( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateBlocklistIdentifierRequestBody] - ) - request = cast(Optional[models.CreateBlocklistIdentifierRequestBody], request) + request = models.CreateBlocklistIdentifierRequestBody( + identifier=identifier, + ) req = self.build_request( method="POST", @@ -408,7 +393,7 @@ def create_blocklist_identifier( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -417,9 +402,9 @@ def create_blocklist_identifier( get_serialized_body=lambda: utils.serialize_request_body( request, False, - True, + False, "json", - Optional[models.CreateBlocklistIdentifierRequestBody], + models.CreateBlocklistIdentifierRequestBody, ), timeout_ms=timeout_ms, ) @@ -469,12 +454,7 @@ def create_blocklist_identifier( async def create_blocklist_identifier_async( self, *, - request: Optional[ - Union[ - models.CreateBlocklistIdentifierRequestBody, - models.CreateBlocklistIdentifierRequestBodyTypedDict, - ] - ] = None, + identifier: str, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -483,7 +463,7 @@ async def create_blocklist_identifier_async( Create an identifier that is blocked from accessing an instance - :param request: The request object to send. + :param identifier: The identifier to be added in the block-list. This can be an email address, a phone number or a web3 wallet. :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 @@ -496,11 +476,9 @@ async def create_blocklist_identifier_async( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateBlocklistIdentifierRequestBody] - ) - request = cast(Optional[models.CreateBlocklistIdentifierRequestBody], request) + request = models.CreateBlocklistIdentifierRequestBody( + identifier=identifier, + ) req = self.build_request_async( method="POST", @@ -508,7 +486,7 @@ async def create_blocklist_identifier_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -517,9 +495,9 @@ async def create_blocklist_identifier_async( get_serialized_body=lambda: utils.serialize_request_body( request, False, - True, + False, "json", - Optional[models.CreateBlocklistIdentifierRequestBody], + models.CreateBlocklistIdentifierRequestBody, ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/betafeatures.py b/src/clerk_backend_api/betafeatures.py index ec8fa23..914f1fb 100644 --- a/src/clerk_backend_api/betafeatures.py +++ b/src/clerk_backend_api/betafeatures.py @@ -12,12 +12,10 @@ class BetaFeatures(BaseSDK): def update_instance_settings( self, *, - request: Optional[ - Union[ - models.UpdateInstanceAuthConfigRequestBody, - models.UpdateInstanceAuthConfigRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.UpdateInstanceAuthConfigRequestBody, + models.UpdateInstanceAuthConfigRequestBodyTypedDict, + ] = models.UpdateInstanceAuthConfigRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -41,9 +39,9 @@ def update_instance_settings( if not isinstance(request, BaseModel): request = utils.unmarshal( - request, Optional[models.UpdateInstanceAuthConfigRequestBody] + request, models.UpdateInstanceAuthConfigRequestBody ) - request = cast(Optional[models.UpdateInstanceAuthConfigRequestBody], request) + request = cast(models.UpdateInstanceAuthConfigRequestBody, request) req = self.build_request( method="PATCH", @@ -51,7 +49,7 @@ def update_instance_settings( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -112,12 +110,10 @@ def update_instance_settings( async def update_instance_settings_async( self, *, - request: Optional[ - Union[ - models.UpdateInstanceAuthConfigRequestBody, - models.UpdateInstanceAuthConfigRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.UpdateInstanceAuthConfigRequestBody, + models.UpdateInstanceAuthConfigRequestBodyTypedDict, + ] = models.UpdateInstanceAuthConfigRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -141,9 +137,9 @@ async def update_instance_settings_async( if not isinstance(request, BaseModel): request = utils.unmarshal( - request, Optional[models.UpdateInstanceAuthConfigRequestBody] + request, models.UpdateInstanceAuthConfigRequestBody ) - request = cast(Optional[models.UpdateInstanceAuthConfigRequestBody], request) + request = cast(models.UpdateInstanceAuthConfigRequestBody, request) req = self.build_request_async( method="PATCH", @@ -151,7 +147,7 @@ async def update_instance_settings_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -426,12 +422,10 @@ async def update_domain_async( def change_production_instance_domain( self, *, - request: Optional[ - Union[ - models.ChangeProductionInstanceDomainRequestBody, - models.ChangeProductionInstanceDomainRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.ChangeProductionInstanceDomainRequestBody, + models.ChangeProductionInstanceDomainRequestBodyTypedDict, + ] = models.ChangeProductionInstanceDomainRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -459,11 +453,9 @@ def change_production_instance_domain( if not isinstance(request, BaseModel): request = utils.unmarshal( - request, Optional[models.ChangeProductionInstanceDomainRequestBody] + request, models.ChangeProductionInstanceDomainRequestBody ) - request = cast( - Optional[models.ChangeProductionInstanceDomainRequestBody], request - ) + request = cast(models.ChangeProductionInstanceDomainRequestBody, request) req = self.build_request( method="POST", @@ -471,7 +463,7 @@ def change_production_instance_domain( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -530,12 +522,10 @@ def change_production_instance_domain( async def change_production_instance_domain_async( self, *, - request: Optional[ - Union[ - models.ChangeProductionInstanceDomainRequestBody, - models.ChangeProductionInstanceDomainRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.ChangeProductionInstanceDomainRequestBody, + models.ChangeProductionInstanceDomainRequestBodyTypedDict, + ] = models.ChangeProductionInstanceDomainRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -563,11 +553,9 @@ async def change_production_instance_domain_async( if not isinstance(request, BaseModel): request = utils.unmarshal( - request, Optional[models.ChangeProductionInstanceDomainRequestBody] + request, models.ChangeProductionInstanceDomainRequestBody ) - request = cast( - Optional[models.ChangeProductionInstanceDomainRequestBody], request - ) + request = cast(models.ChangeProductionInstanceDomainRequestBody, request) req = self.build_request_async( method="POST", @@ -575,7 +563,7 @@ async def change_production_instance_domain_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", diff --git a/src/clerk_backend_api/clerk_redirecturls.py b/src/clerk_backend_api/clerk_redirecturls.py index 20156f9..eaa8e0c 100644 --- a/src/clerk_backend_api/clerk_redirecturls.py +++ b/src/clerk_backend_api/clerk_redirecturls.py @@ -11,12 +11,10 @@ class ClerkRedirectUrls(BaseSDK): def create( self, *, - request: Optional[ - Union[ - models.CreateRedirectURLRequestBody, - models.CreateRedirectURLRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreateRedirectURLRequestBody, + models.CreateRedirectURLRequestBodyTypedDict, + ] = models.CreateRedirectURLRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -39,10 +37,8 @@ def create( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateRedirectURLRequestBody] - ) - request = cast(Optional[models.CreateRedirectURLRequestBody], request) + request = utils.unmarshal(request, models.CreateRedirectURLRequestBody) + request = cast(models.CreateRedirectURLRequestBody, request) req = self.build_request( method="POST", @@ -50,7 +46,7 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -109,12 +105,10 @@ def create( async def create_async( self, *, - request: Optional[ - Union[ - models.CreateRedirectURLRequestBody, - models.CreateRedirectURLRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreateRedirectURLRequestBody, + models.CreateRedirectURLRequestBodyTypedDict, + ] = models.CreateRedirectURLRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -137,10 +131,8 @@ async def create_async( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateRedirectURLRequestBody] - ) - request = cast(Optional[models.CreateRedirectURLRequestBody], request) + request = utils.unmarshal(request, models.CreateRedirectURLRequestBody) + request = cast(models.CreateRedirectURLRequestBody, request) req = self.build_request_async( method="POST", @@ -148,7 +140,7 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", diff --git a/src/clerk_backend_api/clients.py b/src/clerk_backend_api/clients.py index a54b147..5c4e98b 100644 --- a/src/clerk_backend_api/clients.py +++ b/src/clerk_backend_api/clients.py @@ -204,11 +204,9 @@ async def list_async( def verify( self, *, - request: Optional[ - Union[ - models.VerifyClientRequestBody, models.VerifyClientRequestBodyTypedDict - ] - ] = None, + request: Union[ + models.VerifyClientRequestBody, models.VerifyClientRequestBodyTypedDict + ] = models.VerifyClientRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -231,8 +229,8 @@ def verify( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal(request, Optional[models.VerifyClientRequestBody]) - request = cast(Optional[models.VerifyClientRequestBody], request) + request = utils.unmarshal(request, models.VerifyClientRequestBody) + request = cast(models.VerifyClientRequestBody, request) req = self.build_request( method="POST", @@ -240,7 +238,7 @@ def verify( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -295,11 +293,9 @@ def verify( async def verify_async( self, *, - request: Optional[ - Union[ - models.VerifyClientRequestBody, models.VerifyClientRequestBodyTypedDict - ] - ] = None, + request: Union[ + models.VerifyClientRequestBody, models.VerifyClientRequestBodyTypedDict + ] = models.VerifyClientRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -322,8 +318,8 @@ async def verify_async( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal(request, Optional[models.VerifyClientRequestBody]) - request = cast(Optional[models.VerifyClientRequestBody], request) + request = utils.unmarshal(request, models.VerifyClientRequestBody) + request = cast(models.VerifyClientRequestBody, request) req = self.build_request_async( method="POST", @@ -331,7 +327,7 @@ async def verify_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", diff --git a/src/clerk_backend_api/domains_sdk.py b/src/clerk_backend_api/domains_sdk.py index 68d91ba..fa32102 100644 --- a/src/clerk_backend_api/domains_sdk.py +++ b/src/clerk_backend_api/domains_sdk.py @@ -3,8 +3,8 @@ from .basesdk import BaseSDK from clerk_backend_api import models, utils from clerk_backend_api._hooks import HookContext -from clerk_backend_api.types import BaseModel, OptionalNullable, UNSET -from typing import Any, Optional, Union, cast +from clerk_backend_api.types import OptionalNullable, UNSET +from typing import Any, Optional class DomainsSDK(BaseSDK): @@ -161,9 +161,9 @@ async def list_async( def add( self, *, - request: Optional[ - Union[models.AddDomainRequestBody, models.AddDomainRequestBodyTypedDict] - ] = None, + name: str, + is_satellite: bool, + proxy_url: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -176,7 +176,9 @@ def add( At the moment, instances can have only one primary domain, so the `is_satellite` parameter must be set to `true`. If you're planning to configure the new satellite domain to run behind a proxy, pass the `proxy_url` parameter accordingly. - :param request: The request object to send. + :param name: The new domain name. Can contain the port for development instances. + :param is_satellite: Marks the new domain as satellite. Only `true` is accepted at the moment. + :param proxy_url: The full URL of the proxy which will forward requests to the Clerk Frontend API for this domain. Applicable only to production instances. :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 @@ -189,9 +191,11 @@ def add( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, Optional[models.AddDomainRequestBody]) - request = cast(Optional[models.AddDomainRequestBody], request) + request = models.AddDomainRequestBody( + name=name, + is_satellite=is_satellite, + proxy_url=proxy_url, + ) req = self.build_request( method="POST", @@ -199,14 +203,14 @@ def add( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, True, "json", Optional[models.AddDomainRequestBody] + request, False, False, "json", models.AddDomainRequestBody ), timeout_ms=timeout_ms, ) @@ -254,9 +258,9 @@ def add( async def add_async( self, *, - request: Optional[ - Union[models.AddDomainRequestBody, models.AddDomainRequestBodyTypedDict] - ] = None, + name: str, + is_satellite: bool, + proxy_url: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -269,7 +273,9 @@ async def add_async( At the moment, instances can have only one primary domain, so the `is_satellite` parameter must be set to `true`. If you're planning to configure the new satellite domain to run behind a proxy, pass the `proxy_url` parameter accordingly. - :param request: The request object to send. + :param name: The new domain name. Can contain the port for development instances. + :param is_satellite: Marks the new domain as satellite. Only `true` is accepted at the moment. + :param proxy_url: The full URL of the proxy which will forward requests to the Clerk Frontend API for this domain. Applicable only to production instances. :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 @@ -282,9 +288,11 @@ async def add_async( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, Optional[models.AddDomainRequestBody]) - request = cast(Optional[models.AddDomainRequestBody], request) + request = models.AddDomainRequestBody( + name=name, + is_satellite=is_satellite, + proxy_url=proxy_url, + ) req = self.build_request_async( method="POST", @@ -292,14 +300,14 @@ async def add_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, True, "json", Optional[models.AddDomainRequestBody] + request, False, False, "json", models.AddDomainRequestBody ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/emailaddresses.py b/src/clerk_backend_api/emailaddresses.py index dac2690..393b8eb 100644 --- a/src/clerk_backend_api/emailaddresses.py +++ b/src/clerk_backend_api/emailaddresses.py @@ -11,12 +11,10 @@ class EmailAddresses(BaseSDK): def create( self, *, - request: Optional[ - Union[ - models.CreateEmailAddressRequestBody, - models.CreateEmailAddressRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreateEmailAddressRequestBody, + models.CreateEmailAddressRequestBodyTypedDict, + ] = models.CreateEmailAddressRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -39,10 +37,8 @@ def create( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateEmailAddressRequestBody] - ) - request = cast(Optional[models.CreateEmailAddressRequestBody], request) + request = utils.unmarshal(request, models.CreateEmailAddressRequestBody) + request = cast(models.CreateEmailAddressRequestBody, request) req = self.build_request( method="POST", @@ -50,7 +46,7 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -111,12 +107,10 @@ def create( async def create_async( self, *, - request: Optional[ - Union[ - models.CreateEmailAddressRequestBody, - models.CreateEmailAddressRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreateEmailAddressRequestBody, + models.CreateEmailAddressRequestBodyTypedDict, + ] = models.CreateEmailAddressRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -139,10 +133,8 @@ async def create_async( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateEmailAddressRequestBody] - ) - request = cast(Optional[models.CreateEmailAddressRequestBody], request) + request = utils.unmarshal(request, models.CreateEmailAddressRequestBody) + request = cast(models.CreateEmailAddressRequestBody, request) req = self.build_request_async( method="POST", @@ -150,7 +142,7 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -595,7 +587,7 @@ def update( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -604,9 +596,9 @@ def update( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdateEmailAddressRequestBody], + models.UpdateEmailAddressRequestBody, ), timeout_ms=timeout_ms, ) @@ -696,7 +688,7 @@ async def update_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -705,9 +697,9 @@ async def update_async( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdateEmailAddressRequestBody], + models.UpdateEmailAddressRequestBody, ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/httpclient.py b/src/clerk_backend_api/httpclient.py index 36b642a..167cea4 100644 --- a/src/clerk_backend_api/httpclient.py +++ b/src/clerk_backend_api/httpclient.py @@ -41,6 +41,9 @@ def build_request( ) -> httpx.Request: pass + def close(self) -> None: + pass + @runtime_checkable class AsyncHttpClient(Protocol): @@ -76,3 +79,6 @@ def build_request( extensions: Optional[httpx._types.RequestExtensions] = None, ) -> httpx.Request: pass + + async def aclose(self) -> None: + pass diff --git a/src/clerk_backend_api/instancesettings_sdk.py b/src/clerk_backend_api/instancesettings_sdk.py index 1101869..490cdf1 100644 --- a/src/clerk_backend_api/instancesettings_sdk.py +++ b/src/clerk_backend_api/instancesettings_sdk.py @@ -11,12 +11,9 @@ class InstanceSettingsSDK(BaseSDK): def update( self, *, - request: Optional[ - Union[ - models.UpdateInstanceRequestBody, - models.UpdateInstanceRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.UpdateInstanceRequestBody, models.UpdateInstanceRequestBodyTypedDict + ] = models.UpdateInstanceRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -39,10 +36,8 @@ def update( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.UpdateInstanceRequestBody] - ) - request = cast(Optional[models.UpdateInstanceRequestBody], request) + request = utils.unmarshal(request, models.UpdateInstanceRequestBody) + request = cast(models.UpdateInstanceRequestBody, request) req = self.build_request( method="PATCH", @@ -50,7 +45,7 @@ def update( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -105,12 +100,9 @@ def update( async def update_async( self, *, - request: Optional[ - Union[ - models.UpdateInstanceRequestBody, - models.UpdateInstanceRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.UpdateInstanceRequestBody, models.UpdateInstanceRequestBodyTypedDict + ] = models.UpdateInstanceRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -133,10 +125,8 @@ async def update_async( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.UpdateInstanceRequestBody] - ) - request = cast(Optional[models.UpdateInstanceRequestBody], request) + request = utils.unmarshal(request, models.UpdateInstanceRequestBody) + request = cast(models.UpdateInstanceRequestBody, request) req = self.build_request_async( method="PATCH", @@ -144,7 +134,7 @@ async def update_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -199,12 +189,10 @@ async def update_async( def update_restrictions( self, *, - request: Optional[ - Union[ - models.UpdateInstanceRestrictionsRequestBody, - models.UpdateInstanceRestrictionsRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.UpdateInstanceRestrictionsRequestBody, + models.UpdateInstanceRestrictionsRequestBodyTypedDict, + ] = models.UpdateInstanceRestrictionsRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -228,9 +216,9 @@ def update_restrictions( if not isinstance(request, BaseModel): request = utils.unmarshal( - request, Optional[models.UpdateInstanceRestrictionsRequestBody] + request, models.UpdateInstanceRestrictionsRequestBody ) - request = cast(Optional[models.UpdateInstanceRestrictionsRequestBody], request) + request = cast(models.UpdateInstanceRestrictionsRequestBody, request) req = self.build_request( method="PATCH", @@ -238,7 +226,7 @@ def update_restrictions( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -299,12 +287,10 @@ def update_restrictions( async def update_restrictions_async( self, *, - request: Optional[ - Union[ - models.UpdateInstanceRestrictionsRequestBody, - models.UpdateInstanceRestrictionsRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.UpdateInstanceRestrictionsRequestBody, + models.UpdateInstanceRestrictionsRequestBodyTypedDict, + ] = models.UpdateInstanceRestrictionsRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -328,9 +314,9 @@ async def update_restrictions_async( if not isinstance(request, BaseModel): request = utils.unmarshal( - request, Optional[models.UpdateInstanceRestrictionsRequestBody] + request, models.UpdateInstanceRestrictionsRequestBody ) - request = cast(Optional[models.UpdateInstanceRestrictionsRequestBody], request) + request = cast(models.UpdateInstanceRestrictionsRequestBody, request) req = self.build_request_async( method="PATCH", @@ -338,7 +324,7 @@ async def update_restrictions_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -399,12 +385,10 @@ async def update_restrictions_async( def update_organization_settings( self, *, - request: Optional[ - Union[ - models.UpdateInstanceOrganizationSettingsRequestBody, - models.UpdateInstanceOrganizationSettingsRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.UpdateInstanceOrganizationSettingsRequestBody, + models.UpdateInstanceOrganizationSettingsRequestBodyTypedDict, + ] = models.UpdateInstanceOrganizationSettingsRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -428,11 +412,9 @@ def update_organization_settings( if not isinstance(request, BaseModel): request = utils.unmarshal( - request, Optional[models.UpdateInstanceOrganizationSettingsRequestBody] + request, models.UpdateInstanceOrganizationSettingsRequestBody ) - request = cast( - Optional[models.UpdateInstanceOrganizationSettingsRequestBody], request - ) + request = cast(models.UpdateInstanceOrganizationSettingsRequestBody, request) req = self.build_request( method="PATCH", @@ -440,7 +422,7 @@ def update_organization_settings( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -501,12 +483,10 @@ def update_organization_settings( async def update_organization_settings_async( self, *, - request: Optional[ - Union[ - models.UpdateInstanceOrganizationSettingsRequestBody, - models.UpdateInstanceOrganizationSettingsRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.UpdateInstanceOrganizationSettingsRequestBody, + models.UpdateInstanceOrganizationSettingsRequestBodyTypedDict, + ] = models.UpdateInstanceOrganizationSettingsRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -530,11 +510,9 @@ async def update_organization_settings_async( if not isinstance(request, BaseModel): request = utils.unmarshal( - request, Optional[models.UpdateInstanceOrganizationSettingsRequestBody] + request, models.UpdateInstanceOrganizationSettingsRequestBody ) - request = cast( - Optional[models.UpdateInstanceOrganizationSettingsRequestBody], request - ) + request = cast(models.UpdateInstanceOrganizationSettingsRequestBody, request) req = self.build_request_async( method="PATCH", @@ -542,7 +520,7 @@ async def update_organization_settings_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", diff --git a/src/clerk_backend_api/invitations.py b/src/clerk_backend_api/invitations.py index 0bf6c02..e2c240d 100644 --- a/src/clerk_backend_api/invitations.py +++ b/src/clerk_backend_api/invitations.py @@ -3,8 +3,8 @@ from .basesdk import BaseSDK from clerk_backend_api import models, utils from clerk_backend_api._hooks import HookContext -from clerk_backend_api.types import BaseModel, OptionalNullable, UNSET -from typing import Any, List, Optional, Union, cast +from clerk_backend_api.types import OptionalNullable, UNSET +from typing import Any, Dict, List, Optional class Invitations(BaseSDK): @@ -15,12 +15,12 @@ class Invitations(BaseSDK): def create( self, *, - request: Optional[ - Union[ - models.CreateInvitationRequestBody, - models.CreateInvitationRequestBodyTypedDict, - ] - ] = None, + email_address: str, + public_metadata: Optional[Dict[str, Any]] = None, + redirect_url: Optional[str] = None, + notify: OptionalNullable[bool] = True, + ignore_existing: OptionalNullable[bool] = False, + expires_in_days: OptionalNullable[int] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -31,7 +31,12 @@ def create( Keep in mind that you cannot create an invitation if there is already one for the given email address. Also, trying to create an invitation for an email address that already exists in your application will result to an error. - :param request: The request object to send. + :param email_address: The email address the invitation will be sent to + :param public_metadata: Metadata that will be attached to the newly created invitation. The value of this property should be a well-formed JSON object. Once the user accepts the invitation and signs up, these metadata will end up in the user's public metadata. + :param redirect_url: Optional URL which specifies where to redirect the user once they click the invitation link. This is only required if you have implemented a [custom flow](https://clerk.com/docs/authentication/invitations#custom-flow) and you're not using Clerk Hosted Pages or Clerk Components. + :param notify: Optional flag which denotes whether an email invitation should be sent to the given email address. Defaults to true. + :param ignore_existing: Whether an invitation should be created if there is already an existing invitation for this email address, or it's claimed by another user. + :param expires_in_days: The number of days the invitation will be valid for. By default, the invitation does not expire. :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 @@ -44,11 +49,14 @@ def create( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateInvitationRequestBody] - ) - request = cast(Optional[models.CreateInvitationRequestBody], request) + request = models.CreateInvitationRequestBody( + email_address=email_address, + public_metadata=public_metadata, + redirect_url=redirect_url, + notify=notify, + ignore_existing=ignore_existing, + expires_in_days=expires_in_days, + ) req = self.build_request( method="POST", @@ -56,18 +64,14 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateInvitationRequestBody], + request, False, False, "json", models.CreateInvitationRequestBody ), timeout_ms=timeout_ms, ) @@ -115,12 +119,12 @@ def create( async def create_async( self, *, - request: Optional[ - Union[ - models.CreateInvitationRequestBody, - models.CreateInvitationRequestBodyTypedDict, - ] - ] = None, + email_address: str, + public_metadata: Optional[Dict[str, Any]] = None, + redirect_url: Optional[str] = None, + notify: OptionalNullable[bool] = True, + ignore_existing: OptionalNullable[bool] = False, + expires_in_days: OptionalNullable[int] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -131,7 +135,12 @@ async def create_async( Keep in mind that you cannot create an invitation if there is already one for the given email address. Also, trying to create an invitation for an email address that already exists in your application will result to an error. - :param request: The request object to send. + :param email_address: The email address the invitation will be sent to + :param public_metadata: Metadata that will be attached to the newly created invitation. The value of this property should be a well-formed JSON object. Once the user accepts the invitation and signs up, these metadata will end up in the user's public metadata. + :param redirect_url: Optional URL which specifies where to redirect the user once they click the invitation link. This is only required if you have implemented a [custom flow](https://clerk.com/docs/authentication/invitations#custom-flow) and you're not using Clerk Hosted Pages or Clerk Components. + :param notify: Optional flag which denotes whether an email invitation should be sent to the given email address. Defaults to true. + :param ignore_existing: Whether an invitation should be created if there is already an existing invitation for this email address, or it's claimed by another user. + :param expires_in_days: The number of days the invitation will be valid for. By default, the invitation does not expire. :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 @@ -144,11 +153,14 @@ async def create_async( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateInvitationRequestBody] - ) - request = cast(Optional[models.CreateInvitationRequestBody], request) + request = models.CreateInvitationRequestBody( + email_address=email_address, + public_metadata=public_metadata, + redirect_url=redirect_url, + notify=notify, + ignore_existing=ignore_existing, + expires_in_days=expires_in_days, + ) req = self.build_request_async( method="POST", @@ -156,18 +168,14 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateInvitationRequestBody], + request, False, False, "json", models.CreateInvitationRequestBody ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/jwttemplates.py b/src/clerk_backend_api/jwttemplates.py index 2abe5df..1b2f290 100644 --- a/src/clerk_backend_api/jwttemplates.py +++ b/src/clerk_backend_api/jwttemplates.py @@ -157,12 +157,10 @@ async def list_async( def create( self, *, - request: Optional[ - Union[ - models.CreateJWTTemplateRequestBody, - models.CreateJWTTemplateRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreateJWTTemplateRequestBody, + models.CreateJWTTemplateRequestBodyTypedDict, + ] = models.CreateJWTTemplateRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -185,10 +183,8 @@ def create( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateJWTTemplateRequestBody] - ) - request = cast(Optional[models.CreateJWTTemplateRequestBody], request) + request = utils.unmarshal(request, models.CreateJWTTemplateRequestBody) + request = cast(models.CreateJWTTemplateRequestBody, request) req = self.build_request( method="POST", @@ -196,7 +192,7 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -255,12 +251,10 @@ def create( async def create_async( self, *, - request: Optional[ - Union[ - models.CreateJWTTemplateRequestBody, - models.CreateJWTTemplateRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreateJWTTemplateRequestBody, + models.CreateJWTTemplateRequestBodyTypedDict, + ] = models.CreateJWTTemplateRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -283,10 +277,8 @@ async def create_async( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateJWTTemplateRequestBody] - ) - request = cast(Optional[models.CreateJWTTemplateRequestBody], request) + request = utils.unmarshal(request, models.CreateJWTTemplateRequestBody) + request = cast(models.CreateJWTTemplateRequestBody, request) req = self.build_request_async( method="POST", @@ -294,7 +286,7 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -582,7 +574,7 @@ def update( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -591,9 +583,9 @@ def update( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdateJWTTemplateRequestBody], + models.UpdateJWTTemplateRequestBody, ), timeout_ms=timeout_ms, ) @@ -702,7 +694,7 @@ async def update_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -711,9 +703,9 @@ async def update_async( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdateJWTTemplateRequestBody], + models.UpdateJWTTemplateRequestBody, ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/models/emailaddress.py b/src/clerk_backend_api/models/emailaddress.py index 9ec9d52..59e2870 100644 --- a/src/clerk_backend_api/models/emailaddress.py +++ b/src/clerk_backend_api/models/emailaddress.py @@ -15,7 +15,7 @@ from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import List, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict class EmailAddressObject(str, Enum, metaclass=utils.OpenEnumMeta): @@ -226,10 +226,12 @@ class Otp(BaseModel): expire_at: int -VerificationTypedDict = Union[OtpTypedDict, AdminTypedDict, OauthTypedDict] +VerificationTypedDict = TypeAliasType( + "VerificationTypedDict", Union[OtpTypedDict, AdminTypedDict, OauthTypedDict] +) -Verification = Union[Otp, Admin, Oauth] +Verification = TypeAliasType("Verification", Union[Otp, Admin, Oauth]) class EmailAddressTypedDict(TypedDict): diff --git a/src/clerk_backend_api/models/phonenumber.py b/src/clerk_backend_api/models/phonenumber.py index 55abfd8..d1a7e72 100644 --- a/src/clerk_backend_api/models/phonenumber.py +++ b/src/clerk_backend_api/models/phonenumber.py @@ -15,7 +15,7 @@ from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import List, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict class PhoneNumberObject(str, Enum): @@ -119,12 +119,15 @@ class VerificationOTP(BaseModel): expire_at: int -PhoneNumberVerificationTypedDict = Union[ - VerificationOTPTypedDict, VerificationAdminTypedDict -] +PhoneNumberVerificationTypedDict = TypeAliasType( + "PhoneNumberVerificationTypedDict", + Union[VerificationOTPTypedDict, VerificationAdminTypedDict], +) -PhoneNumberVerification = Union[VerificationOTP, VerificationAdmin] +PhoneNumberVerification = TypeAliasType( + "PhoneNumberVerification", Union[VerificationOTP, VerificationAdmin] +) class PhoneNumberTypedDict(TypedDict): diff --git a/src/clerk_backend_api/models/samlaccount.py b/src/clerk_backend_api/models/samlaccount.py index 8c108a9..73af844 100644 --- a/src/clerk_backend_api/models/samlaccount.py +++ b/src/clerk_backend_api/models/samlaccount.py @@ -11,7 +11,7 @@ from enum import Enum from pydantic import model_serializer from typing import Any, Dict, Optional, Union -from typing_extensions import NotRequired, TypedDict +from typing_extensions import NotRequired, TypeAliasType, TypedDict class SAMLAccountObject(str, Enum): @@ -28,6 +28,7 @@ class TicketVerificationStatus(str, Enum): class TicketVerificationStrategy(str, Enum): TICKET = "ticket" + SAML = "saml" class TicketTypedDict(TypedDict): @@ -176,10 +177,12 @@ def serialize_model(self, handler): return m -SAMLAccountVerificationTypedDict = Union[TicketTypedDict, SamlTypedDict] +SAMLAccountVerificationTypedDict = TypeAliasType( + "SAMLAccountVerificationTypedDict", Union[TicketTypedDict, SamlTypedDict] +) -SAMLAccountVerification = Union[Ticket, Saml] +SAMLAccountVerification = TypeAliasType("SAMLAccountVerification", Union[Ticket, Saml]) class SAMLConnectionSAMLConnectionTypedDict(TypedDict): diff --git a/src/clerk_backend_api/models/updateemailaddressop.py b/src/clerk_backend_api/models/updateemailaddressop.py index 6bbdf7b..aeb22c4 100644 --- a/src/clerk_backend_api/models/updateemailaddressop.py +++ b/src/clerk_backend_api/models/updateemailaddressop.py @@ -10,7 +10,6 @@ ) from clerk_backend_api.utils import FieldMetadata, PathParamMetadata, RequestMetadata from pydantic import model_serializer -from typing import Optional from typing_extensions import Annotated, NotRequired, TypedDict @@ -62,7 +61,7 @@ def serialize_model(self, handler): class UpdateEmailAddressRequestTypedDict(TypedDict): email_address_id: str r"""The ID of the email address to update""" - request_body: NotRequired[UpdateEmailAddressRequestBodyTypedDict] + request_body: UpdateEmailAddressRequestBodyTypedDict class UpdateEmailAddressRequest(BaseModel): @@ -72,6 +71,6 @@ class UpdateEmailAddressRequest(BaseModel): r"""The ID of the email address to update""" request_body: Annotated[ - Optional[UpdateEmailAddressRequestBody], + UpdateEmailAddressRequestBody, FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None + ] diff --git a/src/clerk_backend_api/models/updatejwttemplateop.py b/src/clerk_backend_api/models/updatejwttemplateop.py index 371b73c..226cf74 100644 --- a/src/clerk_backend_api/models/updatejwttemplateop.py +++ b/src/clerk_backend_api/models/updatejwttemplateop.py @@ -108,7 +108,7 @@ def serialize_model(self, handler): class UpdateJWTTemplateRequestTypedDict(TypedDict): template_id: str r"""The ID of the JWT template to update""" - request_body: NotRequired[UpdateJWTTemplateRequestBodyTypedDict] + request_body: UpdateJWTTemplateRequestBodyTypedDict class UpdateJWTTemplateRequest(BaseModel): @@ -118,6 +118,6 @@ class UpdateJWTTemplateRequest(BaseModel): r"""The ID of the JWT template to update""" request_body: Annotated[ - Optional[UpdateJWTTemplateRequestBody], + UpdateJWTTemplateRequestBody, FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None + ] diff --git a/src/clerk_backend_api/models/updatephonenumberop.py b/src/clerk_backend_api/models/updatephonenumberop.py index 2fa520b..676ccaf 100644 --- a/src/clerk_backend_api/models/updatephonenumberop.py +++ b/src/clerk_backend_api/models/updatephonenumberop.py @@ -10,7 +10,6 @@ ) from clerk_backend_api.utils import FieldMetadata, PathParamMetadata, RequestMetadata from pydantic import model_serializer -from typing import Optional from typing_extensions import Annotated, NotRequired, TypedDict @@ -73,7 +72,7 @@ def serialize_model(self, handler): class UpdatePhoneNumberRequestTypedDict(TypedDict): phone_number_id: str r"""The ID of the phone number to update""" - request_body: NotRequired[UpdatePhoneNumberRequestBodyTypedDict] + request_body: UpdatePhoneNumberRequestBodyTypedDict class UpdatePhoneNumberRequest(BaseModel): @@ -83,6 +82,6 @@ class UpdatePhoneNumberRequest(BaseModel): r"""The ID of the phone number to update""" request_body: Annotated[ - Optional[UpdatePhoneNumberRequestBody], + UpdatePhoneNumberRequestBody, FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None + ] diff --git a/src/clerk_backend_api/models/updatesignupop.py b/src/clerk_backend_api/models/updatesignupop.py index 6da63cc..37c0041 100644 --- a/src/clerk_backend_api/models/updatesignupop.py +++ b/src/clerk_backend_api/models/updatesignupop.py @@ -10,7 +10,6 @@ ) from clerk_backend_api.utils import FieldMetadata, PathParamMetadata, RequestMetadata from pydantic import model_serializer -from typing import Optional from typing_extensions import Annotated, NotRequired, TypedDict @@ -61,7 +60,7 @@ def serialize_model(self, handler): class UpdateSignUpRequestTypedDict(TypedDict): id: str r"""The ID of the sign-up to update""" - request_body: NotRequired[UpdateSignUpRequestBodyTypedDict] + request_body: UpdateSignUpRequestBodyTypedDict class UpdateSignUpRequest(BaseModel): @@ -71,6 +70,6 @@ class UpdateSignUpRequest(BaseModel): r"""The ID of the sign-up to update""" request_body: Annotated[ - Optional[UpdateSignUpRequestBody], + UpdateSignUpRequestBody, FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None + ] diff --git a/src/clerk_backend_api/models/updateusermetadataop.py b/src/clerk_backend_api/models/updateusermetadataop.py index 189fc13..ba59ccf 100644 --- a/src/clerk_backend_api/models/updateusermetadataop.py +++ b/src/clerk_backend_api/models/updateusermetadataop.py @@ -46,7 +46,7 @@ class UpdateUserMetadataRequestBody(BaseModel): class UpdateUserMetadataRequestTypedDict(TypedDict): user_id: str r"""The ID of the user whose metadata will be updated and merged""" - request_body: NotRequired[UpdateUserMetadataRequestBodyTypedDict] + request_body: UpdateUserMetadataRequestBodyTypedDict class UpdateUserMetadataRequest(BaseModel): @@ -56,6 +56,6 @@ class UpdateUserMetadataRequest(BaseModel): r"""The ID of the user whose metadata will be updated and merged""" request_body: Annotated[ - Optional[UpdateUserMetadataRequestBody], + UpdateUserMetadataRequestBody, FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None + ] diff --git a/src/clerk_backend_api/models/uploadorganizationlogoop.py b/src/clerk_backend_api/models/uploadorganizationlogoop.py index aaf6a8b..7412f6c 100644 --- a/src/clerk_backend_api/models/uploadorganizationlogoop.py +++ b/src/clerk_backend_api/models/uploadorganizationlogoop.py @@ -58,7 +58,7 @@ class UploadOrganizationLogoRequestBody(BaseModel): class UploadOrganizationLogoRequestTypedDict(TypedDict): organization_id: str r"""The ID of the organization for which to upload a logo""" - request_body: NotRequired[UploadOrganizationLogoRequestBodyTypedDict] + request_body: UploadOrganizationLogoRequestBodyTypedDict class UploadOrganizationLogoRequest(BaseModel): @@ -68,6 +68,6 @@ class UploadOrganizationLogoRequest(BaseModel): r"""The ID of the organization for which to upload a logo""" request_body: Annotated[ - Optional[UploadOrganizationLogoRequestBody], + UploadOrganizationLogoRequestBody, FieldMetadata(request=RequestMetadata(media_type="multipart/form-data")), - ] = None + ] diff --git a/src/clerk_backend_api/models/verifyclientop.py b/src/clerk_backend_api/models/verifyclientop.py index 877e1e5..7f7c1c7 100644 --- a/src/clerk_backend_api/models/verifyclientop.py +++ b/src/clerk_backend_api/models/verifyclientop.py @@ -7,14 +7,10 @@ class VerifyClientRequestBodyTypedDict(TypedDict): - r"""Parameters.""" - token: NotRequired[str] r"""A JWT that represents the active client.""" class VerifyClientRequestBody(BaseModel): - r"""Parameters.""" - token: Optional[str] = None r"""A JWT that represents the active client.""" diff --git a/src/clerk_backend_api/models/verifypasswordop.py b/src/clerk_backend_api/models/verifypasswordop.py index 1e13d00..89abf41 100644 --- a/src/clerk_backend_api/models/verifypasswordop.py +++ b/src/clerk_backend_api/models/verifypasswordop.py @@ -20,7 +20,7 @@ class VerifyPasswordRequestBody(BaseModel): class VerifyPasswordRequestTypedDict(TypedDict): user_id: str r"""The ID of the user for whom to verify the password""" - request_body: NotRequired[VerifyPasswordRequestBodyTypedDict] + request_body: VerifyPasswordRequestBodyTypedDict class VerifyPasswordRequest(BaseModel): @@ -30,9 +30,9 @@ class VerifyPasswordRequest(BaseModel): r"""The ID of the user for whom to verify the password""" request_body: Annotated[ - Optional[VerifyPasswordRequestBody], + VerifyPasswordRequestBody, FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None + ] class VerifyPasswordResponseBodyTypedDict(TypedDict): diff --git a/src/clerk_backend_api/models/verifytotpop.py b/src/clerk_backend_api/models/verifytotpop.py index 8532d8b..afceaa0 100644 --- a/src/clerk_backend_api/models/verifytotpop.py +++ b/src/clerk_backend_api/models/verifytotpop.py @@ -21,7 +21,7 @@ class VerifyTOTPRequestBody(BaseModel): class VerifyTOTPRequestTypedDict(TypedDict): user_id: str r"""The ID of the user for whom to verify the TOTP""" - request_body: NotRequired[VerifyTOTPRequestBodyTypedDict] + request_body: VerifyTOTPRequestBodyTypedDict class VerifyTOTPRequest(BaseModel): @@ -31,9 +31,9 @@ class VerifyTOTPRequest(BaseModel): r"""The ID of the user for whom to verify the TOTP""" request_body: Annotated[ - Optional[VerifyTOTPRequestBody], + VerifyTOTPRequestBody, FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None + ] class CodeType(str, Enum): diff --git a/src/clerk_backend_api/models/web3wallet.py b/src/clerk_backend_api/models/web3wallet.py index dfb471d..6205814 100644 --- a/src/clerk_backend_api/models/web3wallet.py +++ b/src/clerk_backend_api/models/web3wallet.py @@ -14,7 +14,7 @@ from pydantic import model_serializer from pydantic.functional_validators import PlainValidator from typing import Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict class Web3WalletObject(str, Enum): @@ -145,12 +145,15 @@ def serialize_model(self, handler): return m -Web3WalletVerificationTypedDict = Union[ - Web3WalletVerificationAdminTypedDict, Web3SignatureTypedDict -] +Web3WalletVerificationTypedDict = TypeAliasType( + "Web3WalletVerificationTypedDict", + Union[Web3WalletVerificationAdminTypedDict, Web3SignatureTypedDict], +) -Web3WalletVerification = Union[Web3WalletVerificationAdmin, Web3Signature] +Web3WalletVerification = TypeAliasType( + "Web3WalletVerification", Union[Web3WalletVerificationAdmin, Web3Signature] +) class Web3WalletTypedDict(TypedDict): diff --git a/src/clerk_backend_api/oauthapplications_sdk.py b/src/clerk_backend_api/oauthapplications_sdk.py index 23e7734..f193c42 100644 --- a/src/clerk_backend_api/oauthapplications_sdk.py +++ b/src/clerk_backend_api/oauthapplications_sdk.py @@ -3,8 +3,8 @@ from .basesdk import BaseSDK from clerk_backend_api import models, utils from clerk_backend_api._hooks import HookContext -from clerk_backend_api.types import BaseModel, OptionalNullable, UNSET -from typing import Any, Optional, Union, cast +from clerk_backend_api.types import OptionalNullable, UNSET +from typing import Any, Optional class OauthApplicationsSDK(BaseSDK): @@ -195,12 +195,10 @@ async def list_async( def create( self, *, - request: Optional[ - Union[ - models.CreateOAuthApplicationRequestBody, - models.CreateOAuthApplicationRequestBodyTypedDict, - ] - ] = None, + name: str, + callback_url: str, + scopes: Optional[str] = "profile email", + public: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -211,7 +209,10 @@ def create( The callback URL must be a valid url. All URL schemes are allowed such as `http://`, `https://`, `myapp://`, etc... - :param request: The request object to send. + :param name: The name of the new OAuth application + :param callback_url: The callback URL of the new OAuth application + :param scopes: Define the allowed scopes for the new OAuth applications that dictate the user payload of the OAuth user info endpoint. Available scopes are `profile`, `email`, `public_metadata`, `private_metadata`. Provide the requested scopes as a string, separated by spaces. + :param public: If true, this client is public and cannot securely store a client secret. Only the authorization code flow with proof key for code exchange (PKCE) may be used. Public clients cannot be updated to be confidential clients, and vice versa. :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 @@ -224,11 +225,12 @@ def create( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateOAuthApplicationRequestBody] - ) - request = cast(Optional[models.CreateOAuthApplicationRequestBody], request) + request = models.CreateOAuthApplicationRequestBody( + name=name, + callback_url=callback_url, + scopes=scopes, + public=public, + ) req = self.build_request( method="POST", @@ -236,18 +238,14 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateOAuthApplicationRequestBody], + request, False, False, "json", models.CreateOAuthApplicationRequestBody ), timeout_ms=timeout_ms, ) @@ -297,12 +295,10 @@ def create( async def create_async( self, *, - request: Optional[ - Union[ - models.CreateOAuthApplicationRequestBody, - models.CreateOAuthApplicationRequestBodyTypedDict, - ] - ] = None, + name: str, + callback_url: str, + scopes: Optional[str] = "profile email", + public: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -313,7 +309,10 @@ async def create_async( The callback URL must be a valid url. All URL schemes are allowed such as `http://`, `https://`, `myapp://`, etc... - :param request: The request object to send. + :param name: The name of the new OAuth application + :param callback_url: The callback URL of the new OAuth application + :param scopes: Define the allowed scopes for the new OAuth applications that dictate the user payload of the OAuth user info endpoint. Available scopes are `profile`, `email`, `public_metadata`, `private_metadata`. Provide the requested scopes as a string, separated by spaces. + :param public: If true, this client is public and cannot securely store a client secret. Only the authorization code flow with proof key for code exchange (PKCE) may be used. Public clients cannot be updated to be confidential clients, and vice versa. :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 @@ -326,11 +325,12 @@ async def create_async( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateOAuthApplicationRequestBody] - ) - request = cast(Optional[models.CreateOAuthApplicationRequestBody], request) + request = models.CreateOAuthApplicationRequestBody( + name=name, + callback_url=callback_url, + scopes=scopes, + public=public, + ) req = self.build_request_async( method="POST", @@ -338,18 +338,14 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateOAuthApplicationRequestBody], + request, False, False, "json", models.CreateOAuthApplicationRequestBody ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/organizations_sdk.py b/src/clerk_backend_api/organizations_sdk.py index aa6641b..ebea3f7 100644 --- a/src/clerk_backend_api/organizations_sdk.py +++ b/src/clerk_backend_api/organizations_sdk.py @@ -3,8 +3,8 @@ from .basesdk import BaseSDK from clerk_backend_api import models, utils from clerk_backend_api._hooks import HookContext -from clerk_backend_api.types import BaseModel, OptionalNullable, UNSET -from typing import Any, Dict, Optional, Union, cast +from clerk_backend_api.types import OptionalNullable, UNSET +from typing import Any, Dict, Optional, Union class OrganizationsSDK(BaseSDK): @@ -213,12 +213,13 @@ async def list_async( def create( self, *, - request: Optional[ - Union[ - models.CreateOrganizationRequestBody, - models.CreateOrganizationRequestBodyTypedDict, - ] - ] = None, + name: str, + created_by: str, + private_metadata: Optional[Dict[str, Any]] = None, + public_metadata: Optional[Dict[str, Any]] = None, + slug: Optional[str] = None, + max_allowed_memberships: Optional[int] = None, + created_at: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -237,7 +238,13 @@ def create( The `created_by` user will see this as their [active organization] (https://clerk.com/docs/organizations/overview#active-organization) the next time they create a session, presuming they don't explicitly set a different organization as active before then. - :param request: The request object to send. + :param name: The name of the new organization. May not contain URLs or HTML. + :param created_by: The ID of the User who will become the administrator for the new organization + :param private_metadata: Metadata saved on the organization, accessible only from the Backend API + :param public_metadata: Metadata saved on the organization, read-only from the Frontend API and fully accessible (read/write) from the Backend API + :param slug: A slug for the new organization. Can contain only lowercase alphanumeric characters and the dash \"-\". Must be unique for the instance. + :param max_allowed_memberships: The maximum number of memberships allowed for this organization + :param created_at: A custom date/time denoting _when_ the organization was created, 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 @@ -250,11 +257,15 @@ def create( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateOrganizationRequestBody] - ) - request = cast(Optional[models.CreateOrganizationRequestBody], request) + request = models.CreateOrganizationRequestBody( + name=name, + created_by=created_by, + private_metadata=private_metadata, + public_metadata=public_metadata, + slug=slug, + max_allowed_memberships=max_allowed_memberships, + created_at=created_at, + ) req = self.build_request( method="POST", @@ -262,18 +273,14 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateOrganizationRequestBody], + request, False, False, "json", models.CreateOrganizationRequestBody ), timeout_ms=timeout_ms, ) @@ -321,12 +328,13 @@ def create( async def create_async( self, *, - request: Optional[ - Union[ - models.CreateOrganizationRequestBody, - models.CreateOrganizationRequestBodyTypedDict, - ] - ] = None, + name: str, + created_by: str, + private_metadata: Optional[Dict[str, Any]] = None, + public_metadata: Optional[Dict[str, Any]] = None, + slug: Optional[str] = None, + max_allowed_memberships: Optional[int] = None, + created_at: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -345,7 +353,13 @@ async def create_async( The `created_by` user will see this as their [active organization] (https://clerk.com/docs/organizations/overview#active-organization) the next time they create a session, presuming they don't explicitly set a different organization as active before then. - :param request: The request object to send. + :param name: The name of the new organization. May not contain URLs or HTML. + :param created_by: The ID of the User who will become the administrator for the new organization + :param private_metadata: Metadata saved on the organization, accessible only from the Backend API + :param public_metadata: Metadata saved on the organization, read-only from the Frontend API and fully accessible (read/write) from the Backend API + :param slug: A slug for the new organization. Can contain only lowercase alphanumeric characters and the dash \"-\". Must be unique for the instance. + :param max_allowed_memberships: The maximum number of memberships allowed for this organization + :param created_at: A custom date/time denoting _when_ the organization was created, 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 @@ -358,11 +372,15 @@ async def create_async( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateOrganizationRequestBody] - ) - request = cast(Optional[models.CreateOrganizationRequestBody], request) + request = models.CreateOrganizationRequestBody( + name=name, + created_by=created_by, + private_metadata=private_metadata, + public_metadata=public_metadata, + slug=slug, + max_allowed_memberships=max_allowed_memberships, + created_at=created_at, + ) req = self.build_request_async( method="POST", @@ -370,18 +388,14 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateOrganizationRequestBody], + request, False, False, "json", models.CreateOrganizationRequestBody ), timeout_ms=timeout_ms, ) @@ -1257,7 +1271,7 @@ def upload_logo( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -1266,9 +1280,9 @@ def upload_logo( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "multipart", - Optional[models.UploadOrganizationLogoRequestBody], + models.UploadOrganizationLogoRequestBody, ), timeout_ms=timeout_ms, ) @@ -1366,7 +1380,7 @@ async def upload_logo_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -1375,9 +1389,9 @@ async def upload_logo_async( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "multipart", - Optional[models.UploadOrganizationLogoRequestBody], + models.UploadOrganizationLogoRequestBody, ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/phonenumbers.py b/src/clerk_backend_api/phonenumbers.py index 33673f7..94ff216 100644 --- a/src/clerk_backend_api/phonenumbers.py +++ b/src/clerk_backend_api/phonenumbers.py @@ -11,12 +11,10 @@ class PhoneNumbers(BaseSDK): def create( self, *, - request: Optional[ - Union[ - models.CreatePhoneNumberRequestBody, - models.CreatePhoneNumberRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreatePhoneNumberRequestBody, + models.CreatePhoneNumberRequestBodyTypedDict, + ] = models.CreatePhoneNumberRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -39,10 +37,8 @@ def create( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreatePhoneNumberRequestBody] - ) - request = cast(Optional[models.CreatePhoneNumberRequestBody], request) + request = utils.unmarshal(request, models.CreatePhoneNumberRequestBody) + request = cast(models.CreatePhoneNumberRequestBody, request) req = self.build_request( method="POST", @@ -50,7 +46,7 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -111,12 +107,10 @@ def create( async def create_async( self, *, - request: Optional[ - Union[ - models.CreatePhoneNumberRequestBody, - models.CreatePhoneNumberRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreatePhoneNumberRequestBody, + models.CreatePhoneNumberRequestBodyTypedDict, + ] = models.CreatePhoneNumberRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -139,10 +133,8 @@ async def create_async( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreatePhoneNumberRequestBody] - ) - request = cast(Optional[models.CreatePhoneNumberRequestBody], request) + request = utils.unmarshal(request, models.CreatePhoneNumberRequestBody) + request = cast(models.CreatePhoneNumberRequestBody, request) req = self.build_request_async( method="POST", @@ -150,7 +142,7 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -598,7 +590,7 @@ def update( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -607,9 +599,9 @@ def update( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdatePhoneNumberRequestBody], + models.UpdatePhoneNumberRequestBody, ), timeout_ms=timeout_ms, ) @@ -702,7 +694,7 @@ async def update_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -711,9 +703,9 @@ async def update_async( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdatePhoneNumberRequestBody], + models.UpdatePhoneNumberRequestBody, ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/proxychecks.py b/src/clerk_backend_api/proxychecks.py index 26784fc..c99d78f 100644 --- a/src/clerk_backend_api/proxychecks.py +++ b/src/clerk_backend_api/proxychecks.py @@ -11,12 +11,10 @@ class ProxyChecks(BaseSDK): def verify( self, *, - request: Optional[ - Union[ - models.VerifyDomainProxyRequestBody, - models.VerifyDomainProxyRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.VerifyDomainProxyRequestBody, + models.VerifyDomainProxyRequestBodyTypedDict, + ] = models.VerifyDomainProxyRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -46,10 +44,8 @@ def verify( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.VerifyDomainProxyRequestBody] - ) - request = cast(Optional[models.VerifyDomainProxyRequestBody], request) + request = utils.unmarshal(request, models.VerifyDomainProxyRequestBody) + request = cast(models.VerifyDomainProxyRequestBody, request) req = self.build_request( method="POST", @@ -57,7 +53,7 @@ def verify( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -116,12 +112,10 @@ def verify( async def verify_async( self, *, - request: Optional[ - Union[ - models.VerifyDomainProxyRequestBody, - models.VerifyDomainProxyRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.VerifyDomainProxyRequestBody, + models.VerifyDomainProxyRequestBodyTypedDict, + ] = models.VerifyDomainProxyRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -151,10 +145,8 @@ async def verify_async( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.VerifyDomainProxyRequestBody] - ) - request = cast(Optional[models.VerifyDomainProxyRequestBody], request) + request = utils.unmarshal(request, models.VerifyDomainProxyRequestBody) + request = cast(models.VerifyDomainProxyRequestBody, request) req = self.build_request_async( method="POST", @@ -162,7 +154,7 @@ async def verify_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", diff --git a/src/clerk_backend_api/samlconnections_sdk.py b/src/clerk_backend_api/samlconnections_sdk.py index 7c7117e..46a9d9e 100644 --- a/src/clerk_backend_api/samlconnections_sdk.py +++ b/src/clerk_backend_api/samlconnections_sdk.py @@ -3,8 +3,8 @@ from .basesdk import BaseSDK from clerk_backend_api import models, utils from clerk_backend_api._hooks import HookContext -from clerk_backend_api.types import BaseModel, OptionalNullable, UNSET -from typing import Any, Optional, Union, cast +from clerk_backend_api.types import OptionalNullable, UNSET +from typing import Any, Optional, Union class SamlConnectionsSDK(BaseSDK): @@ -189,12 +189,20 @@ async def list_async( def create( self, *, - request: Optional[ + name: str, + domain: str, + provider: models.Provider, + idp_entity_id: OptionalNullable[str] = UNSET, + idp_sso_url: OptionalNullable[str] = UNSET, + idp_certificate: OptionalNullable[str] = UNSET, + idp_metadata_url: OptionalNullable[str] = UNSET, + idp_metadata: OptionalNullable[str] = UNSET, + attribute_mapping: OptionalNullable[ Union[ - models.CreateSAMLConnectionRequestBody, - models.CreateSAMLConnectionRequestBodyTypedDict, + models.CreateSAMLConnectionAttributeMapping, + models.CreateSAMLConnectionAttributeMappingTypedDict, ] - ] = None, + ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -203,7 +211,15 @@ def create( Create a new SAML Connection. - :param request: The request object to send. + :param name: The name to use as a label for this SAML Connection + :param domain: The domain of your organization. Sign in flows using an email with this domain, will use this SAML Connection. + :param provider: The IdP provider of the connection. + :param idp_entity_id: The Entity ID as provided by the IdP + :param idp_sso_url: The Single-Sign On URL as provided by the IdP + :param idp_certificate: The X.509 certificate as provided by the IdP + :param idp_metadata_url: The URL which serves the IdP metadata. If present, it takes priority over the corresponding individual properties + :param idp_metadata: The XML content of the IdP metadata file. If present, it takes priority over the corresponding individual properties + :param attribute_mapping: Define the attribute name mapping between Identity Provider and Clerk's user properties :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 @@ -216,11 +232,20 @@ def create( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateSAMLConnectionRequestBody] - ) - request = cast(Optional[models.CreateSAMLConnectionRequestBody], request) + request = models.CreateSAMLConnectionRequestBody( + name=name, + domain=domain, + provider=provider, + idp_entity_id=idp_entity_id, + idp_sso_url=idp_sso_url, + idp_certificate=idp_certificate, + idp_metadata_url=idp_metadata_url, + idp_metadata=idp_metadata, + attribute_mapping=utils.get_pydantic_model( + attribute_mapping, + OptionalNullable[models.CreateSAMLConnectionAttributeMapping], + ), + ) req = self.build_request( method="POST", @@ -228,18 +253,14 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateSAMLConnectionRequestBody], + request, False, False, "json", models.CreateSAMLConnectionRequestBody ), timeout_ms=timeout_ms, ) @@ -289,12 +310,20 @@ def create( async def create_async( self, *, - request: Optional[ + name: str, + domain: str, + provider: models.Provider, + idp_entity_id: OptionalNullable[str] = UNSET, + idp_sso_url: OptionalNullable[str] = UNSET, + idp_certificate: OptionalNullable[str] = UNSET, + idp_metadata_url: OptionalNullable[str] = UNSET, + idp_metadata: OptionalNullable[str] = UNSET, + attribute_mapping: OptionalNullable[ Union[ - models.CreateSAMLConnectionRequestBody, - models.CreateSAMLConnectionRequestBodyTypedDict, + models.CreateSAMLConnectionAttributeMapping, + models.CreateSAMLConnectionAttributeMappingTypedDict, ] - ] = None, + ] = UNSET, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -303,7 +332,15 @@ async def create_async( Create a new SAML Connection. - :param request: The request object to send. + :param name: The name to use as a label for this SAML Connection + :param domain: The domain of your organization. Sign in flows using an email with this domain, will use this SAML Connection. + :param provider: The IdP provider of the connection. + :param idp_entity_id: The Entity ID as provided by the IdP + :param idp_sso_url: The Single-Sign On URL as provided by the IdP + :param idp_certificate: The X.509 certificate as provided by the IdP + :param idp_metadata_url: The URL which serves the IdP metadata. If present, it takes priority over the corresponding individual properties + :param idp_metadata: The XML content of the IdP metadata file. If present, it takes priority over the corresponding individual properties + :param attribute_mapping: Define the attribute name mapping between Identity Provider and Clerk's user properties :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 @@ -316,11 +353,20 @@ async def create_async( if server_url is not None: base_url = server_url - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateSAMLConnectionRequestBody] - ) - request = cast(Optional[models.CreateSAMLConnectionRequestBody], request) + request = models.CreateSAMLConnectionRequestBody( + name=name, + domain=domain, + provider=provider, + idp_entity_id=idp_entity_id, + idp_sso_url=idp_sso_url, + idp_certificate=idp_certificate, + idp_metadata_url=idp_metadata_url, + idp_metadata=idp_metadata, + attribute_mapping=utils.get_pydantic_model( + attribute_mapping, + OptionalNullable[models.CreateSAMLConnectionAttributeMapping], + ), + ) req = self.build_request_async( method="POST", @@ -328,18 +374,14 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[models.CreateSAMLConnectionRequestBody], + request, False, False, "json", models.CreateSAMLConnectionRequestBody ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/sdk.py b/src/clerk_backend_api/sdk.py index db741d5..48df145 100644 --- a/src/clerk_backend_api/sdk.py +++ b/src/clerk_backend_api/sdk.py @@ -231,3 +231,17 @@ def _init_sdks(self): self.oauth_applications = OauthApplicationsSDK(self.sdk_configuration) self.saml_connections = SamlConnectionsSDK(self.sdk_configuration) self.testing_tokens = TestingTokens(self.sdk_configuration) + + def __enter__(self): + return self + + async def __aenter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + if self.sdk_configuration.client is not None: + self.sdk_configuration.client.close() + + async def __aexit__(self, exc_type, exc_val, exc_tb): + if self.sdk_configuration.async_client is not None: + await self.sdk_configuration.async_client.aclose() diff --git a/src/clerk_backend_api/sdkconfiguration.py b/src/clerk_backend_api/sdkconfiguration.py index 99f099e..59e4e82 100644 --- a/src/clerk_backend_api/sdkconfiguration.py +++ b/src/clerk_backend_api/sdkconfiguration.py @@ -26,9 +26,9 @@ class SDKConfiguration: server_idx: Optional[int] = 0 language: str = "python" openapi_doc_version: str = "v1" - sdk_version: str = "1.3.1" - gen_version: str = "2.457.1" - user_agent: str = "speakeasy-sdk/python 1.3.1 2.457.1 v1 clerk-backend-api" + sdk_version: str = "1.4.0" + gen_version: str = "2.466.0" + user_agent: str = "speakeasy-sdk/python 1.4.0 2.466.0 v1 clerk-backend-api" retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET) timeout_ms: Optional[int] = None diff --git a/src/clerk_backend_api/signintokens.py b/src/clerk_backend_api/signintokens.py index 5e9660e..3a4c369 100644 --- a/src/clerk_backend_api/signintokens.py +++ b/src/clerk_backend_api/signintokens.py @@ -11,12 +11,10 @@ class SignInTokens(BaseSDK): def create( self, *, - request: Optional[ - Union[ - models.CreateSignInTokenRequestBody, - models.CreateSignInTokenRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreateSignInTokenRequestBody, + models.CreateSignInTokenRequestBodyTypedDict, + ] = models.CreateSignInTokenRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -41,10 +39,8 @@ def create( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateSignInTokenRequestBody] - ) - request = cast(Optional[models.CreateSignInTokenRequestBody], request) + request = utils.unmarshal(request, models.CreateSignInTokenRequestBody) + request = cast(models.CreateSignInTokenRequestBody, request) req = self.build_request( method="POST", @@ -52,7 +48,7 @@ def create( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", @@ -111,12 +107,10 @@ def create( async def create_async( self, *, - request: Optional[ - Union[ - models.CreateSignInTokenRequestBody, - models.CreateSignInTokenRequestBodyTypedDict, - ] - ] = None, + request: Union[ + models.CreateSignInTokenRequestBody, + models.CreateSignInTokenRequestBodyTypedDict, + ] = models.CreateSignInTokenRequestBody(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -141,10 +135,8 @@ async def create_async( base_url = server_url if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, Optional[models.CreateSignInTokenRequestBody] - ) - request = cast(Optional[models.CreateSignInTokenRequestBody], request) + request = utils.unmarshal(request, models.CreateSignInTokenRequestBody) + request = cast(models.CreateSignInTokenRequestBody, request) req = self.build_request_async( method="POST", @@ -152,7 +144,7 @@ async def create_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=False, request_has_query_params=True, user_agent_header="user-agent", diff --git a/src/clerk_backend_api/signups.py b/src/clerk_backend_api/signups.py index a3dbdb4..7365286 100644 --- a/src/clerk_backend_api/signups.py +++ b/src/clerk_backend_api/signups.py @@ -48,7 +48,7 @@ def update( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -57,9 +57,9 @@ def update( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdateSignUpRequestBody], + models.UpdateSignUpRequestBody, ), timeout_ms=timeout_ms, ) @@ -144,7 +144,7 @@ async def update_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -153,9 +153,9 @@ async def update_async( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdateSignUpRequestBody], + models.UpdateSignUpRequestBody, ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/users.py b/src/clerk_backend_api/users.py index 052ba7f..27e1304 100644 --- a/src/clerk_backend_api/users.py +++ b/src/clerk_backend_api/users.py @@ -2423,7 +2423,7 @@ def update_metadata( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -2432,9 +2432,9 @@ def update_metadata( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdateUserMetadataRequestBody], + models.UpdateUserMetadataRequestBody, ), timeout_ms=timeout_ms, ) @@ -2534,7 +2534,7 @@ async def update_metadata_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -2543,9 +2543,9 @@ async def update_metadata_async( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.UpdateUserMetadataRequestBody], + models.UpdateUserMetadataRequestBody, ), timeout_ms=timeout_ms, ) @@ -3189,7 +3189,7 @@ def verify_password( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -3198,9 +3198,9 @@ def verify_password( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.VerifyPasswordRequestBody], + models.VerifyPasswordRequestBody, ), timeout_ms=timeout_ms, ) @@ -3288,7 +3288,7 @@ async def verify_password_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", @@ -3297,9 +3297,9 @@ async def verify_password_async( get_serialized_body=lambda: utils.serialize_request_body( request.request_body, False, - True, + False, "json", - Optional[models.VerifyPasswordRequestBody], + models.VerifyPasswordRequestBody, ), timeout_ms=timeout_ms, ) @@ -3389,18 +3389,14 @@ def verify_totp( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request.request_body, - False, - True, - "json", - Optional[models.VerifyTOTPRequestBody], + request.request_body, False, False, "json", models.VerifyTOTPRequestBody ), timeout_ms=timeout_ms, ) @@ -3490,18 +3486,14 @@ async def verify_totp_async( base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request.request_body, - False, - True, - "json", - Optional[models.VerifyTOTPRequestBody], + request.request_body, False, False, "json", models.VerifyTOTPRequestBody ), timeout_ms=timeout_ms, ) diff --git a/src/clerk_backend_api/utils/annotations.py b/src/clerk_backend_api/utils/annotations.py index 5b3bbb0..387874e 100644 --- a/src/clerk_backend_api/utils/annotations.py +++ b/src/clerk_backend_api/utils/annotations.py @@ -1,30 +1,55 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from enum import Enum -from typing import Any +from typing import Any, Optional def get_discriminator(model: Any, fieldname: str, key: str) -> str: - if isinstance(model, dict): - try: - return f'{model.get(key)}' - except AttributeError as e: - raise ValueError(f'Could not find discriminator key {key} in {model}') from e + """ + Recursively search for the discriminator attribute in a model. - if hasattr(model, fieldname): - attr = getattr(model, fieldname) + Args: + model (Any): The model to search within. + fieldname (str): The name of the field to search for. + key (str): The key to search for in dictionaries. - if isinstance(attr, Enum): - return f'{attr.value}' + Returns: + str: The name of the discriminator attribute. - return f'{attr}' + Raises: + ValueError: If the discriminator attribute is not found. + """ + upper_fieldname = fieldname.upper() - fieldname = fieldname.upper() - if hasattr(model, fieldname): - attr = getattr(model, fieldname) + def get_field_discriminator(field: Any) -> Optional[str]: + """Search for the discriminator attribute in a given field.""" - if isinstance(attr, Enum): - return f'{attr.value}' + if isinstance(field, dict): + if key in field: + return f'{field[key]}' - return f'{attr}' + if hasattr(field, fieldname): + attr = getattr(field, fieldname) + if isinstance(attr, Enum): + return f'{attr.value}' + return f'{attr}' + + if hasattr(field, upper_fieldname): + attr = getattr(field, upper_fieldname) + if isinstance(attr, Enum): + return f'{attr.value}' + return f'{attr}' + + return None + + + if isinstance(model, list): + for field in model: + discriminator = get_field_discriminator(field) + if discriminator is not None: + return discriminator + + discriminator = get_field_discriminator(model) + if discriminator is not None: + return discriminator raise ValueError(f'Could not find discriminator field {fieldname} in {model}') diff --git a/src/clerk_backend_api/utils/eventstreaming.py b/src/clerk_backend_api/utils/eventstreaming.py index 553b386..74a63f7 100644 --- a/src/clerk_backend_api/utils/eventstreaming.py +++ b/src/clerk_backend_api/utils/eventstreaming.py @@ -2,12 +2,72 @@ import re import json -from typing import Callable, TypeVar, Optional, Generator, AsyncGenerator, Tuple +from typing import ( + Callable, + Generic, + TypeVar, + Optional, + Generator, + AsyncGenerator, + Tuple, +) import httpx T = TypeVar("T") +class EventStream(Generic[T]): + response: httpx.Response + generator: Generator[T, None, None] + + def __init__( + self, + response: httpx.Response, + decoder: Callable[[str], T], + sentinel: Optional[str] = None, + ): + self.response = response + self.generator = stream_events(response, decoder, sentinel) + + def __iter__(self): + return self + + def __next__(self): + return next(self.generator) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.response.close() + + +class EventStreamAsync(Generic[T]): + response: httpx.Response + generator: AsyncGenerator[T, None] + + def __init__( + self, + response: httpx.Response, + decoder: Callable[[str], T], + sentinel: Optional[str] = None, + ): + self.response = response + self.generator = stream_events_async(response, decoder, sentinel) + + def __aiter__(self): + return self + + async def __anext__(self): + return await self.generator.__anext__() + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_val, exc_tb): + await self.response.aclose() + + class ServerEvent: id: Optional[str] = None event: Optional[str] = None