diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 54da3b4b..24f9232f 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: 8ea02849be1e1f42c2495da5d1a78ee7 + docChecksum: 666851cd8862fc0afb78f03035ac694f docVersion: v1 - speakeasyVersion: 1.476.2 - generationVersion: 2.495.1 - releaseVersion: 1.7.2 - configChecksum: 2edf0312216c23ae97ddd131cc613a78 + speakeasyVersion: 1.495.1 + generationVersion: 2.515.4 + releaseVersion: 1.8.0 + configChecksum: f2d806d8305c9acbe482890760470fad repoURL: https://github.com/clerk/clerk-sdk-python.git installationURL: https://github.com/clerk/clerk-sdk-python.git published: true @@ -15,7 +15,7 @@ features: additionalDependencies: 1.0.0 additionalProperties: 1.0.1 constsAndDefaults: 1.0.5 - core: 5.10.5 + core: 5.11.0 customCodeRegions: 0.1.1 defaultEnabledRetries: 0.2.0 deprecations: 3.0.2 @@ -23,8 +23,8 @@ features: envVarSecurityUsage: 0.3.2 examples: 3.0.1 flatRequests: 1.0.1 - flattening: 3.1.0 - globalSecurity: 3.0.2 + flattening: 3.1.1 + globalSecurity: 3.0.3 globalSecurityCallbacks: 1.0.0 globalSecurityFlattening: 1.0.0 globalServerURLs: 3.1.0 @@ -32,11 +32,11 @@ features: methodArguments: 1.0.2 multipartFileContentType: 1.0.0 nameOverrides: 3.0.1 - nullables: 1.0.0 + nullables: 1.0.1 openEnums: 1.0.0 responseFormat: 1.0.1 retries: 3.0.2 - sdkHooks: 1.0.0 + sdkHooks: 1.0.1 unions: 3.0.4 uploadStreams: 1.0.0 generatedFiles: @@ -106,7 +106,6 @@ generatedFiles: - docs/models/createsessiontokenresponsebody.md - docs/models/createsignintokenrequestbody.md - docs/models/createuserrequestbody.md - - docs/models/createusertotprequest.md - docs/models/createwaitlistentryrequestbody.md - docs/models/deleteallowlistidentifierrequest.md - docs/models/deletebackupcoderequest.md @@ -308,7 +307,6 @@ generatedFiles: - docs/models/toggletemplatedeliveryrequestbody.md - docs/models/totalcount.md - docs/models/totalcountobject.md - - docs/models/totp.md - docs/models/unbanuserrequest.md - docs/models/unlockuserrequest.md - docs/models/updatedomainrequest.md @@ -486,7 +484,6 @@ generatedFiles: - src/clerk_backend_api/models/createsessiontokenop.py - src/clerk_backend_api/models/createsignintokenop.py - src/clerk_backend_api/models/createuserop.py - - src/clerk_backend_api/models/createusertotpop.py - src/clerk_backend_api/models/createwaitlistentryop.py - src/clerk_backend_api/models/deleteallowlistidentifierop.py - src/clerk_backend_api/models/deletebackupcodeop.py @@ -592,7 +589,6 @@ generatedFiles: - src/clerk_backend_api/models/testingtoken.py - src/clerk_backend_api/models/toggletemplatedeliveryop.py - src/clerk_backend_api/models/totalcount.py - - src/clerk_backend_api/models/totp.py - src/clerk_backend_api/models/unbanuserop.py - src/clerk_backend_api/models/unlockuserop.py - src/clerk_backend_api/models/updatedomainop.py @@ -714,7 +710,7 @@ examples: application/json: {"user_id": "user_12345", "email_address": "example@clerk.com", "verified": false, "primary": true} responses: "200": - application/json: {"id": "email_id_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 1620000000, "attempts": 0}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001} + application/json: {"id": "email_id_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 1620000000, "attempts": 0, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001} "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": {}} GetEmailAddress: @@ -724,7 +720,7 @@ examples: email_address_id: "email_address_id_example" responses: "200": - application/json: {"id": "email_id_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 1620000000, "attempts": 0}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001} + application/json: {"id": "email_id_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 1620000000, "attempts": 0, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001} "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": {}} DeleteEmailAddress: @@ -746,7 +742,7 @@ examples: application/json: {"verified": false, "primary": true} responses: "200": - application/json: {"id": "email_id_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 1620000000, "attempts": 0}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001} + application/json: {"id": "email_id_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 1620000000, "attempts": 0, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001} "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": {}} CreatePhoneNumber: @@ -755,7 +751,7 @@ examples: application/json: {"user_id": "usr_12345", "phone_number": "+11234567890", "verified": true, "primary": false, "reserved_for_second_factor": false} responses: "200": - application/json: {"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023} + application/json: {"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023} "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": {}} GetPhoneNumber: @@ -765,7 +761,7 @@ examples: phone_number_id: "phone_12345" responses: "200": - application/json: {"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023} + application/json: {"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023} "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": {}} DeletePhoneNumber: @@ -787,7 +783,7 @@ examples: application/json: {"verified": false, "primary": true, "reserved_for_second_factor": true} responses: "200": - application/json: {"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023} + application/json: {"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023} "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": {}} GetSessionList: @@ -965,9 +961,10 @@ examples: limit: 20 offset: 10 order_by: "-created_at" + banned: false 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", "error": {"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}, "expire_at": 1620000000, "attempts": 0}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "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": "phone_code", "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, "external_accounts": [{}], "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": 152837, "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", "error": {"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}, "expire_at": 1620000000, "attempts": 0}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "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": "phone_code", "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, "external_accounts": [{}], "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": 86140, "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": "from_oauth_apple", "error": {"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}, "expire_at": 1615462399, "attempts": 1}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "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, "external_accounts": [{}], "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": 54607, "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", "error": {"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}, "expire_at": 1620000000, "attempts": 0, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "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": "phone_code", "attempts": 2, "expire_at": 1622852400, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_id_123"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1609459200, "updated_at": 1609459200}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "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, "verified_at_client": ""}, "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": 152837, "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", "error": {"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}, "expire_at": 1620000000, "attempts": 0, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "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": "phone_code", "attempts": 2, "expire_at": 1622852400, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_id_123"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1609459200, "updated_at": 1609459200}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "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, "verified_at_client": ""}, "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": 86140, "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": "from_oauth_apple", "error": {"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}, "expire_at": 1615462399, "attempts": 1, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1609459200, "updated_at": 1609459200}], "phone_numbers": [{"id": "phone_id_123", "object": "phone_number", "phone_number": "+12345678901", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 2, "expire_at": 1622852400, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_id_123"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1609459200, "updated_at": 1609459200}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "saml_accounts": [{"id": "saml_account_id_123", "object": "saml_account", "provider": "SAML Provider", "active": true, "email_address": "user@example.com", "first_name": "John", "last_name": "Doe", "provider_user_id": "prov_user_id_123", "public_metadata": {"department": "IT"}, "verification": {"status": "verified", "strategy": "saml", "external_verification_redirect_url": "https://example.com/saml_callback", "error": null, "expire_at": 1622852400, "attempts": null, "verified_at_client": ""}, "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": 54607, "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": {}} CreateUser: @@ -976,7 +973,7 @@ examples: application/json: {"external_id": "ext-id-001", "first_name": "John", "last_name": "Doe", "email_address": ["john.doe@example.com"], "phone_number": ["+12345678901"], "web3_wallet": ["0x123456789abcdef0x123456789abcdef"], "username": "johndoe123", "password": "Secure*Pass4", "password_digest": "$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc", "password_hasher": "", "skip_password_checks": false, "skip_password_requirement": false, "totp_secret": "base32totpsecretkey", "backup_codes": ["123456", "654321"], "public_metadata": {"role": "user"}, "private_metadata": {"internal_id": "789"}, "unsafe_metadata": {"preferences": {"theme": "dark"}}, "delete_self_enabled": true, "legal_accepted_at": "", "skip_legal_checks": false, "create_organization_enabled": true, "create_organizations_limit": 134365, "created_at": "2023-03-15T07:15:20.902Z"} 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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "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": 86, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "saml_accounts": [{"id": "saml_account_id_123", "object": "saml_account", "provider": "SAML Provider", "active": true, "email_address": "user@example.com", "first_name": "John", "last_name": "Doe", "provider_user_id": "prov_user_id_123", "public_metadata": {"department": "IT"}, "verification": {"status": "verified", "strategy": "saml", "external_verification_redirect_url": "https://example.com/saml_callback", "error": null, "expire_at": 1622852400, "attempts": null, "verified_at_client": ""}, "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": 86, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "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": {}} GetUsersCount: @@ -993,6 +990,7 @@ examples: email_address_query: "" phone_number_query: "" username_query: "" + banned: true responses: "200": application/json: {"object": "total_count", "total_count": 100} @@ -1005,7 +1003,7 @@ examples: user_id: "usr_1" 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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "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": 521235, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 558834, "attempts": 544221, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "saml_accounts": [{"id": "saml_account_id_123", "object": "saml_account", "provider": "SAML Provider", "active": true, "email_address": "user@example.com", "first_name": "John", "last_name": "Doe", "provider_user_id": "prov_user_id_123", "public_metadata": {"department": "IT"}, "verification": {"status": "verified", "strategy": "saml", "external_verification_redirect_url": "https://example.com/saml_callback", "error": null, "expire_at": 1622852400, "attempts": null, "verified_at_client": ""}, "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": 521235, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "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": {}} UpdateUser: @@ -1017,7 +1015,7 @@ examples: application/json: {"external_id": "ext_123", "first_name": "Jane", "last_name": "Doe", "primary_email_address_id": "eml_12345", "notify_primary_email_address_changed": true, "primary_phone_number_id": "phn_67890", "primary_web3_wallet_id": "wlt_123", "username": "janedoe", "profile_image_id": "img_789", "password": "secretPass123!", "password_digest": "$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc", "password_hasher": "", "skip_password_checks": false, "sign_out_of_other_sessions": true, "totp_secret": "ABCD1234EFGH5678", "backup_codes": ["123456", "654321"], "public_metadata": {"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"} 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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "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": 488852, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 597129, "attempts": 344620, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "saml_accounts": [{"id": "saml_account_id_123", "object": "saml_account", "provider": "SAML Provider", "active": true, "email_address": "user@example.com", "first_name": "John", "last_name": "Doe", "provider_user_id": "prov_user_id_123", "public_metadata": {"department": "IT"}, "verification": {"status": "verified", "strategy": "saml", "external_verification_redirect_url": "https://example.com/saml_callback", "error": null, "expire_at": 1622852400, "attempts": null, "verified_at_client": ""}, "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": 488852, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "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": {}} DeleteUser: @@ -1037,7 +1035,7 @@ examples: user_id: "user_12345" 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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "saml_accounts": [{"id": "saml_account_id_123", "object": "saml_account", "provider": "SAML Provider", "active": true, "email_address": "user@example.com", "first_name": "John", "last_name": "Doe", "provider_user_id": "prov_user_id_123", "public_metadata": {"department": "IT"}, "verification": {"status": "verified", "strategy": "saml", "external_verification_redirect_url": "https://example.com/saml_callback", "error": null, "expire_at": 1622852400, "attempts": null}, "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": 274486, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 22794, "attempts": 431195, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "saml_accounts": [{"id": "saml_account_id_123", "object": "saml_account", "provider": "SAML Provider", "active": true, "email_address": "user@example.com", "first_name": "John", "last_name": "Doe", "provider_user_id": "prov_user_id_123", "public_metadata": {"department": "IT"}, "verification": {"status": "verified", "strategy": "saml", "external_verification_redirect_url": "https://example.com/saml_callback", "error": null, "expire_at": 1622852400, "attempts": null, "verified_at_client": ""}, "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": 274486, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "402": application/json: {"errors": [{"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}], "meta": {}} UnbanUser: @@ -1047,7 +1045,7 @@ examples: user_id: "user_12345" 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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "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": 894025, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "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, "verified_at_client": ""}, "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": 894025, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "402": application/json: {"errors": [{"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}], "meta": {}} LockUser: @@ -1057,7 +1055,7 @@ examples: user_id: "user_123456789" 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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "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": 830993, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "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, "verified_at_client": ""}, "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": 830993, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "403": application/json: {"errors": [{"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}], "meta": {}} UnlockUser: @@ -1067,7 +1065,7 @@ examples: user_id: "user_12345" 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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "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": 550861, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "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, "verified_at_client": ""}, "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": 550861, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "403": application/json: {"errors": [{"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}], "meta": {}} SetUserProfileImage: @@ -1079,7 +1077,7 @@ examples: multipart/form-data: {"file": {"": ""}} responses: "200": - application/json: {"id": "user_id_123", "object": "user", "external_id": "external_user_id_123", "primary_email_address_id": "email_id_123", "primary_phone_number_id": "phone_id_123", "primary_web3_wallet_id": "wallet_id_123", "username": "john_doe", "first_name": "John", "last_name": "Doe", "image_url": "https://example.com/new-profile.jpg", "has_image": true, "public_metadata": {"role": "admin"}, "private_metadata": {"ssn": "123-45-6789"}, "unsafe_metadata": {"theme": "dark"}, "email_addresses": [{"id": "email_id_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "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": 67260, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "error": {"message": "Invalid input", "long_message": "The input provided does not meet the requirements.", "code": "400_bad_request", "meta": {}, "clerk_trace_id": "trace_123456789abcd"}, "expire_at": 791625, "attempts": 739191, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "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, "verified_at_client": ""}, "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": 67260, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "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": {}} DeleteUserProfileImage: @@ -1089,7 +1087,7 @@ examples: user_id: "usr_test123" 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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "saml_accounts": [{"id": "saml_account_id_123", "object": "saml_account", "provider": "SAML Provider", "active": true, "email_address": "user@example.com", "first_name": "John", "last_name": "Doe", "provider_user_id": "prov_user_id_123", "public_metadata": {"department": "IT"}, "verification": {"status": "verified", "strategy": "saml", "external_verification_redirect_url": "https://example.com/saml_callback", "error": null, "expire_at": 1622852400, "attempts": null}, "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": 935500, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": true, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "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, "verified_at_client": ""}, "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": 935500, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "404": application/json: {"errors": [{"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}], "meta": {}} UpdateUserMetadata: @@ -1101,7 +1099,7 @@ examples: application/json: {"public_metadata": {"key": "", "key1": ""}, "private_metadata": {"key": "", "key1": "", "key2": ""}, "unsafe_metadata": {"key": ""}} 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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null}, "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, "external_accounts": [{}], "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": 661662, "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_56789", "object": "email_address", "email_address": "example@clerk.com", "reserved": false, "verification": {"status": "verified", "strategy": "admin", "attempts": 0, "expire_at": 1620000000, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "matches_sso_connection": false, "created_at": 1615458901, "updated_at": 1615459001}], "phone_numbers": [{"id": "ph_123456789", "object": "phone_number", "phone_number": "+11234567890", "reserved_for_second_factor": false, "default_second_factor": true, "reserved": false, "verification": {"status": "verified", "strategy": "email_code", "attempts": 1, "expire_at": 1615462399, "verified_at_client": ""}, "linked_to": [{"type": "oauth_google", "id": "link_12345"}], "backup_codes": ["code1", "code2", "code3"], "created_at": 1594842023, "updated_at": 1604842023}], "web3_wallets": [{"id": "wallet_id_123", "object": "web3_wallet", "web3_wallet": "0x123456789abcdef", "verification": {"status": "verified", "strategy": "web3_metamask_signature", "nonce": "nonce_value", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}, "created_at": 1609459200, "updated_at": 1609459200}], "passkeys": [{"id": "passkey_id_123", "object": "passkey", "name": "My Passkey", "last_used_at": 1615852800, "verification": {"status": "verified", "strategy": "passkey", "nonce": "nonce", "message": "", "attempts": null, "expire_at": null, "verified_at_client": ""}}], "password_enabled": true, "two_factor_enabled": true, "totp_enabled": true, "backup_code_enabled": true, "mfa_enabled_at": 1615852800, "mfa_disabled_at": null, "external_accounts": [{}], "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, "verified_at_client": ""}, "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": 661662, "last_active_at": 1700690400000, "legal_accepted_at": 1700690400000} "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": {}} GetOAuthAccessToken: @@ -1617,6 +1615,7 @@ examples: include_members_count: false query: "clerk" order_by: "-name" + organization_id: ["-name"] responses: "200": application/json: {"data": [{"object": "organization", "id": "org_123", "name": "Acme Corp", "slug": "acme-corp", "members_count": 150, "max_allowed_memberships": 300, "admin_delete_enabled": true, "public_metadata": {"public_info": "Info visible to everyone"}, "private_metadata": {"internal_use_only": "Sensitive data"}, "created_by": "user_123456", "created_at": 1625078400, "updated_at": 1625164800}], "total_count": 1} @@ -1909,16 +1908,16 @@ examples: offset: 10 responses: "200": - application/json: {"data": [{"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://neglected-plastic.biz", "token_introspection_url": "https://crooked-overload.name/", "created_at": 1609459200, "updated_at": 1612137600}], "total_count": 1} + application/json: {"data": [{"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "redirect_uris": ["", "", ""], "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://remorseful-concentration.biz", "token_introspection_url": "https://primary-paintwork.com/", "created_at": 1609459200, "updated_at": 1612137600}], "total_count": 1} "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": {}} CreateOAuthApplication: speakeasy-default-create-O-auth-application: requestBody: - application/json: {"name": "Example App", "callback_url": "https://example.com/oauth/callback", "scopes": "profile email public_metadata", "public": true} + application/json: {"name": "Example App", "redirect_uris": ["", ""], "callback_url": "https://example.com/oauth/callback", "scopes": "profile email public_metadata", "public": true} responses: "200": - application/json: {"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://probable-heating.com/", "token_introspection_url": "https://standard-utilization.com/", "created_at": 1609459200, "updated_at": 1612137600, "client_secret": "secretXYZ123"} + application/json: {"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "redirect_uris": ["", ""], "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://probable-heating.com/", "token_introspection_url": "https://standard-utilization.com/", "created_at": 1609459200, "updated_at": 1612137600, "client_secret": "secretXYZ123"} "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": {}} GetOAuthApplication: @@ -1928,7 +1927,7 @@ examples: oauth_application_id: "oauth_app_12345" responses: "200": - application/json: {"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://normal-making.name", "token_introspection_url": "https://lavish-ice-cream.biz", "created_at": 1609459200, "updated_at": 1612137600} + application/json: {"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "redirect_uris": ["", ""], "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://normal-making.name", "token_introspection_url": "https://lavish-ice-cream.biz", "created_at": 1609459200, "updated_at": 1612137600} "403": application/json: {"errors": [{"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}], "meta": {}} UpdateOAuthApplication: @@ -1937,12 +1936,14 @@ examples: path: oauth_application_id: "oauth_app_67890" requestBody: - application/json: {"name": "Updated OAuth App Name", "callback_url": "https://example.com/oauth/callback", "scopes": "profile email public_metadata private_metadata"} + application/json: {"name": "Updated OAuth App Name", "redirect_uris": ["", "", ""], "callback_url": "https://example.com/oauth/callback", "scopes": "profile email public_metadata private_metadata", "public": false} responses: "200": - application/json: {"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://passionate-flu.org", "token_introspection_url": "https://lumbering-wheel.com", "created_at": 1609459200, "updated_at": 1612137600} + application/json: {"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "redirect_uris": [""], "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://passionate-flu.org", "token_introspection_url": "https://lumbering-wheel.com", "created_at": 1609459200, "updated_at": 1612137600} "403": application/json: {"errors": [{"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}], "meta": {}} + "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": {}} DeleteOAuthApplication: speakeasy-default-delete-O-auth-application: parameters: @@ -1960,7 +1961,7 @@ examples: oauth_application_id: "oauth_application_12345" responses: "200": - application/json: {"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://enchanting-language.org", "token_introspection_url": "https://tempting-popularity.net/", "created_at": 1609459200, "updated_at": 1612137600, "client_secret": "secretXYZ123"} + application/json: {"object": "oauth_application", "id": "oauth_app_1234", "instance_id": "instance_5678", "name": "Example OAuth App", "client_id": "client_12345", "public": false, "scopes": "profile email", "redirect_uris": ["", "", ""], "callback_url": "https://example.com/oauth/callback", "authorize_url": "https://example.com/authorize", "token_fetch_url": "https://example.com/oauth/token", "user_info_url": "https://example.com/userinfo", "discovery_url": "https://enchanting-language.org", "token_introspection_url": "https://tempting-popularity.net/", "created_at": 1609459200, "updated_at": 1612137600, "client_secret": "secretXYZ123"} "403": application/json: {"errors": [{"message": "Error message", "long_message": "Longer error message with more details", "code": "error_code", "meta": {}, "clerk_trace_id": "trace_id"}], "meta": {}} ListSAMLConnections: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 8703a146..317f0422 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -7,13 +7,15 @@ generation: useClassNamesForArrayFields: true fixes: nameResolutionDec2023: true + nameResolutionFeb2025: false parameterOrderingFeb2024: true requestResponseComponentNamesFeb2024: true + securityFeb2025: false auth: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false python: - version: 1.7.2 + version: 1.8.0 additionalDependencies: dev: pytest: ^8.3.3 @@ -46,5 +48,6 @@ python: methodArguments: infer-optional-args outputModelSuffix: output packageName: clerk-backend-api + pytestTimeout: 0 responseFormat: flat templateVersion: v2 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index d80f915a..69d4eed4 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.476.2 +speakeasyVersion: 1.495.1 sources: clerk-openapi: sourceNamespace: clerk-openapi - sourceRevisionDigest: sha256:e62e325e0873c460e0721bc6d2b981344e31422506daf0046387149d34d181b1 - sourceBlobDigest: sha256:44db509095f005a99fa7dfa4639cf59e2ff18bbb131c2fcbb353338188c19867 + sourceRevisionDigest: sha256:d4b68e7b261c9fd23c346291e7ca8c925d1c834140e3f0a1807a11ef7f3d41bb + sourceBlobDigest: sha256:d384523908f855f5394f6242512679e5215cfdaf50bc8a7053f15a46cc565a61 tags: - latest - - speakeasy-sdk-regen-1738023555 + - speakeasy-sdk-regen-1739751656 - v1 targets: clerk-sdk-python: source: clerk-openapi sourceNamespace: clerk-openapi - sourceRevisionDigest: sha256:e62e325e0873c460e0721bc6d2b981344e31422506daf0046387149d34d181b1 - sourceBlobDigest: sha256:44db509095f005a99fa7dfa4639cf59e2ff18bbb131c2fcbb353338188c19867 + sourceRevisionDigest: sha256:d4b68e7b261c9fd23c346291e7ca8c925d1c834140e3f0a1807a11ef7f3d41bb + sourceBlobDigest: sha256:d384523908f855f5394f6242512679e5215cfdaf50bc8a7053f15a46cc565a61 codeSamplesNamespace: clerk-openapi-python-code-samples - codeSamplesRevisionDigest: sha256:2b50cd962c45919ae71be3aefb2e772eb47f89bf6ecabd3de17c21bfc6f1b3c4 + codeSamplesRevisionDigest: sha256:366daf506ce8c8a843d3a1fb9b5a300d0afec1dac988ef6aa32b312f43e49f0e workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 7585ac04..71ee002b 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,37 @@ pip install clerk-backend-api ```bash poetry add clerk-backend-api ``` + +### Shell and script usage with `uv` + +You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so: + +```shell +uvx --from clerk-backend-api python +``` + +It's also possible to write a standalone Python script without needing to set up a whole project like so: + +```python +#!/usr/bin/env -S uv run --script +# /// script +# requires-python = ">=3.9" +# dependencies = [ +# "clerk-backend-api", +# ] +# /// + +from clerk_backend_api import Clerk + +sdk = Clerk( + # SDK arguments +) + +# Rest of script here... +``` + +Once that is saved to a file, you can run it with `uv run script.py` where +`script.py` can be replaced with the actual file name. @@ -407,7 +438,6 @@ If the request is correctly authenticated, the token's payload is made available * [delete_backup_codes](docs/sdks/users/README.md#delete_backup_codes) - Disable all user's Backup codes * [delete_passkey](docs/sdks/users/README.md#delete_passkey) - Delete a user passkey * [delete_web3_wallet](docs/sdks/users/README.md#delete_web3_wallet) - Delete a user web3 wallet -* [create_totp](docs/sdks/users/README.md#create_totp) - Create a TOTP for a user * [delete_totp](docs/sdks/users/README.md#delete_totp) - Delete all the user's TOTPs * [delete_external_account](docs/sdks/users/README.md#delete_external_account) - Delete External Account @@ -546,7 +576,7 @@ with Clerk( ### Override Server URL Per-Client -The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example: +The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example: ```python from clerk_backend_api import Clerk diff --git a/RELEASES.md b/RELEASES.md index ec05d851..51074e88 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -248,4 +248,14 @@ Based on: ### Generated - [python v1.7.2] . ### Releases -- [PyPI v1.7.2] https://pypi.org/project/clerk-backend-api/1.7.2 - . \ No newline at end of file +- [PyPI v1.7.2] https://pypi.org/project/clerk-backend-api/1.7.2 - . + +## 2025-02-19 19:06:55 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.495.1 (2.515.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.8.0] . +### Releases +- [PyPI v1.8.0] https://pypi.org/project/clerk-backend-api/1.8.0 - . \ No newline at end of file diff --git a/docs/models/admin.md b/docs/models/admin.md index 5979d183..d0efeede 100644 --- a/docs/models/admin.md +++ b/docs/models/admin.md @@ -7,5 +7,6 @@ | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | | `status` | [models.AdminVerificationStatus](../models/adminverificationstatus.md) | :heavy_check_mark: | N/A | verified | | `strategy` | [models.VerificationStrategy](../models/verificationstrategy.md) | :heavy_check_mark: | N/A | admin | -| `attempts` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 0 | -| `expire_at` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 1620000000 | \ No newline at end of file +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | 0 | +| `expire_at` | *Nullable[int]* | :heavy_check_mark: | N/A | 1620000000 | +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/createoauthapplicationrequestbody.md b/docs/models/createoauthapplicationrequestbody.md index 1251b247..6d4866cb 100644 --- a/docs/models/createoauthapplicationrequestbody.md +++ b/docs/models/createoauthapplicationrequestbody.md @@ -6,6 +6,7 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `name` | *str* | :heavy_check_mark: | The name of the new OAuth application | Example App | -| `callback_url` | *Optional[str]* | :heavy_minus_sign: | 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 | \ No newline at end of file +| `redirect_uris` | List[*str*] | :heavy_minus_sign: | An array of redirect URIs of the new OAuth application | | +| ~~`callback_url`~~ | *OptionalNullable[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

The callback URL of the new OAuth application | https://example.com/oauth/callback | +| `scopes` | *OptionalNullable[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` | *OptionalNullable[bool]* | :heavy_minus_sign: | If true, this client is public and you can use the Proof Key of Code Exchange (PKCE) flow. | true | \ No newline at end of file diff --git a/docs/models/createusertotprequest.md b/docs/models/createusertotprequest.md deleted file mode 100644 index 6c0c1c40..00000000 --- a/docs/models/createusertotprequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# CreateUserTOTPRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `user_id` | *str* | :heavy_check_mark: | The ID of the user for whom the TOTP is being created. | \ No newline at end of file diff --git a/docs/models/createwaitlistentryrequestbody.md b/docs/models/createwaitlistentryrequestbody.md index fcd4c057..fec4849d 100644 --- a/docs/models/createwaitlistentryrequestbody.md +++ b/docs/models/createwaitlistentryrequestbody.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `email_address` | *str* | :heavy_check_mark: | The email address to add to the waitlist | -| `notify` | *Optional[bool]* | :heavy_minus_sign: | Optional flag which denotes whether an email invitation should be sent to the given email address.
Defaults to `true`. | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `email_address` | *str* | :heavy_check_mark: | The email address to add to the waitlist | +| `notify` | *Optional[bool]* | :heavy_minus_sign: | Optional flag which denotes whether a confirmation email should be sent to the given email address.
Defaults to `true`. | \ No newline at end of file diff --git a/docs/models/fromoauth.md b/docs/models/fromoauth.md index 5bda140d..9e2e97fe 100644 --- a/docs/models/fromoauth.md +++ b/docs/models/fromoauth.md @@ -8,5 +8,6 @@ | `status` | [models.FromOAuthVerificationStatus](../models/fromoauthverificationstatus.md) | :heavy_check_mark: | N/A | | `strategy` | *str* | :heavy_check_mark: | N/A | | `expire_at` | *Nullable[int]* | :heavy_check_mark: | N/A | +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | | `error` | [OptionalNullable[models.Error]](../models/error.md) | :heavy_minus_sign: | N/A | -| `attempts` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/getuserlistrequest.md b/docs/models/getuserlistrequest.md index d03fb4d7..cbdc989b 100644 --- a/docs/models/getuserlistrequest.md +++ b/docs/models/getuserlistrequest.md @@ -17,6 +17,7 @@ | `phone_number_query` | *Optional[str]* | :heavy_minus_sign: | Returns users with phone numbers that match the given query, via case-insensitive partial match.
For example, `phone_number_query=555` will match a user with the phone number `+1555xxxxxxx`. | | | `username_query` | *Optional[str]* | :heavy_minus_sign: | Returns users with usernames that match the given query, via case-insensitive partial match.
For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`. | | | `name_query` | *Optional[str]* | :heavy_minus_sign: | Returns users with names that match the given query, via case-insensitive partial match. | | +| `banned` | *Optional[bool]* | :heavy_minus_sign: | Returns users which are either banned (`banned=true`) or not banned (`banned=false`). | | | `last_active_at_before` | *Optional[int]* | :heavy_minus_sign: | Returns users whose last session activity was before the given date (with millisecond precision).
Example: use 1700690400000 to retrieve users whose last session activity was before 2023-11-23. | 1700690400000 | | `last_active_at_after` | *Optional[int]* | :heavy_minus_sign: | Returns users whose last session activity was after the given date (with millisecond precision).
Example: use 1700690400000 to retrieve users whose last session activity was after 2023-11-23. | 1700690400000 | | ~~`last_active_at_since`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Returns users that had session activity since the given date.
Example: use 1700690400000 to retrieve users that had session activity from 2023-11-23 until the current day.
Deprecated in favor of `last_active_at_after`. | 1700690400000 | diff --git a/docs/models/getuserscountrequest.md b/docs/models/getuserscountrequest.md index cc28b6ea..4815ef16 100644 --- a/docs/models/getuserscountrequest.md +++ b/docs/models/getuserscountrequest.md @@ -14,4 +14,5 @@ | `query` | *Optional[str]* | :heavy_minus_sign: | Counts users that match the given query.
For possible matches, we check the email addresses, phone numbers, usernames, web3 wallets, user ids, first and last names.
The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well. | John Doe | | `email_address_query` | *Optional[str]* | :heavy_minus_sign: | Counts users with emails that match the given query, via case-insensitive partial match.
For example, `email_address_query=ello` will match a user with the email `HELLO@example.com`,
and will be included in the resulting count. | | | `phone_number_query` | *Optional[str]* | :heavy_minus_sign: | Counts users with phone numbers that match the given query, via case-insensitive partial match.
For example, `phone_number_query=555` will match a user with the phone number `+1555xxxxxxx`,
and will be included in the resulting count. | | -| `username_query` | *Optional[str]* | :heavy_minus_sign: | Counts users with usernames that match the given query, via case-insensitive partial match.
For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`,
and will be included in the resulting count. | | \ No newline at end of file +| `username_query` | *Optional[str]* | :heavy_minus_sign: | Counts users with usernames that match the given query, via case-insensitive partial match.
For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`,
and will be included in the resulting count. | | +| `banned` | *Optional[bool]* | :heavy_minus_sign: | Counts users which are either banned (`banned=true`) or not banned (`banned=false`). | | \ No newline at end of file diff --git a/docs/models/listorganizationsrequest.md b/docs/models/listorganizationsrequest.md index 43d1360d..3bbd8396 100644 --- a/docs/models/listorganizationsrequest.md +++ b/docs/models/listorganizationsrequest.md @@ -9,4 +9,5 @@ | `offset` | *Optional[int]* | :heavy_minus_sign: | Skip the first `offset` results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with `limit`. | 10 | | `include_members_count` | *Optional[bool]* | :heavy_minus_sign: | Flag to denote whether the member counts of each organization should be included in the response or not. | false | | `query` | *Optional[str]* | :heavy_minus_sign: | Returns organizations with ID, name, or slug that match the given query.
Uses exact match for organization ID and partial match for name and slug. | clerk | -| `order_by` | *Optional[str]* | :heavy_minus_sign: | Allows to return organizations in a particular order.
At the moment, you can order the returned organizations either by their `name`, `created_at` or `members_count`.
In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by.
For example, if you want organizations to be returned in descending order according to their `created_at` property, you can use `-created_at`.
If you don't use `+` or `-`, then `+` is implied.
Defaults to `-created_at`. | -name | \ No newline at end of file +| `organization_id` | List[*str*] | :heavy_minus_sign: | Returns organizations with the organization ids specified.
Any organization ids not found are ignored.
For each organization id, the `+` and `-` can be
prepended to the id, which denote whether the
respective organization should be included or
excluded from the result set.
Accepts up to 100 organization ids.
Example: ?organization_id=+org_1&organization_id=-org_2 | -name | +| `order_by` | *Optional[str]* | :heavy_minus_sign: | Allows to return organizations in a particular order.
At the moment, you can order the returned organizations either by their `name`, `created_at` or `members_count`.
In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by.
For example, if you want organizations to be returned in descending order according to their `created_at` property, you can use `-created_at`.
If you don't use `+` or `-`, then `+` is implied.
Defaults to `-created_at`. | | \ No newline at end of file diff --git a/docs/models/listwaitlistentriesrequest.md b/docs/models/listwaitlistentriesrequest.md index 4c2ac412..7520fe00 100644 --- a/docs/models/listwaitlistentriesrequest.md +++ b/docs/models/listwaitlistentriesrequest.md @@ -7,6 +7,6 @@ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `limit` | *Optional[int]* | :heavy_minus_sign: | Applies a limit to the number of results returned.
Can be used for paginating the results together with `offset`. | 20 | | `offset` | *Optional[int]* | :heavy_minus_sign: | Skip the first `offset` results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with `limit`. | 10 | -| `query` | *Optional[str]* | :heavy_minus_sign: | Filter waitlist entries by email address | | +| `query` | *Optional[str]* | :heavy_minus_sign: | Filter waitlist entries by `email_address` or `id` | | | `status` | [Optional[models.ListWaitlistEntriesQueryParamStatus]](../models/listwaitlistentriesqueryparamstatus.md) | :heavy_minus_sign: | Filter waitlist entries by their status | | | `order_by` | *Optional[str]* | :heavy_minus_sign: | Specify the order of results. Supported values are:
- `created_at`
- `email_address`
- `invited_at`

Use `+` for ascending or `-` for descending order. Defaults to `-created_at`. | | \ No newline at end of file diff --git a/docs/models/oauthapplication.md b/docs/models/oauthapplication.md index affc6536..67998436 100644 --- a/docs/models/oauthapplication.md +++ b/docs/models/oauthapplication.md @@ -3,20 +3,21 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `object` | [models.OAuthApplicationObject](../models/oauthapplicationobject.md) | :heavy_check_mark: | N/A | oauth_application | -| `id` | *str* | :heavy_check_mark: | N/A | oauth_app_1234 | -| `instance_id` | *str* | :heavy_check_mark: | N/A | instance_5678 | -| `name` | *str* | :heavy_check_mark: | N/A | Example OAuth App | -| `client_id` | *str* | :heavy_check_mark: | N/A | client_12345 | -| `public` | *bool* | :heavy_check_mark: | N/A | false | -| `scopes` | *str* | :heavy_check_mark: | N/A | profile email | -| `callback_url` | *str* | :heavy_check_mark: | N/A | https://example.com/oauth/callback | -| `authorize_url` | *str* | :heavy_check_mark: | N/A | https://example.com/authorize | -| `token_fetch_url` | *str* | :heavy_check_mark: | N/A | https://example.com/oauth/token | -| `user_info_url` | *str* | :heavy_check_mark: | N/A | https://example.com/userinfo | -| `discovery_url` | *str* | :heavy_check_mark: | N/A | | -| `token_introspection_url` | *str* | :heavy_check_mark: | N/A | | -| `created_at` | *int* | :heavy_check_mark: | Unix timestamp of creation.
| 1609459200 | -| `updated_at` | *int* | :heavy_check_mark: | Unix timestamp of last update.
| 1612137600 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `object` | [models.OAuthApplicationObject](../models/oauthapplicationobject.md) | :heavy_check_mark: | N/A | oauth_application | +| `id` | *str* | :heavy_check_mark: | N/A | oauth_app_1234 | +| `instance_id` | *str* | :heavy_check_mark: | N/A | instance_5678 | +| `name` | *str* | :heavy_check_mark: | N/A | Example OAuth App | +| `client_id` | *str* | :heavy_check_mark: | N/A | client_12345 | +| `public` | *bool* | :heavy_check_mark: | N/A | false | +| `scopes` | *str* | :heavy_check_mark: | N/A | profile email | +| `redirect_uris` | List[*str*] | :heavy_check_mark: | N/A | | +| ~~`callback_url`~~ | *str* | :heavy_check_mark: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | https://example.com/oauth/callback | +| `authorize_url` | *str* | :heavy_check_mark: | N/A | https://example.com/authorize | +| `token_fetch_url` | *str* | :heavy_check_mark: | N/A | https://example.com/oauth/token | +| `user_info_url` | *str* | :heavy_check_mark: | N/A | https://example.com/userinfo | +| `discovery_url` | *str* | :heavy_check_mark: | N/A | | +| `token_introspection_url` | *str* | :heavy_check_mark: | N/A | | +| `created_at` | *int* | :heavy_check_mark: | Unix timestamp of creation.
| 1609459200 | +| `updated_at` | *int* | :heavy_check_mark: | Unix timestamp of last update.
| 1612137600 | \ No newline at end of file diff --git a/docs/models/oauthapplicationwithsecret.md b/docs/models/oauthapplicationwithsecret.md index c0dbdbf9..f18edcef 100644 --- a/docs/models/oauthapplicationwithsecret.md +++ b/docs/models/oauthapplicationwithsecret.md @@ -3,21 +3,22 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `object` | [models.OAuthApplicationWithSecretObject](../models/oauthapplicationwithsecretobject.md) | :heavy_check_mark: | N/A | oauth_application | -| `id` | *str* | :heavy_check_mark: | N/A | oauth_app_1234 | -| `instance_id` | *str* | :heavy_check_mark: | N/A | instance_5678 | -| `name` | *str* | :heavy_check_mark: | N/A | Example OAuth App | -| `client_id` | *str* | :heavy_check_mark: | N/A | client_12345 | -| `public` | *bool* | :heavy_check_mark: | N/A | false | -| `scopes` | *str* | :heavy_check_mark: | N/A | profile email | -| `callback_url` | *str* | :heavy_check_mark: | N/A | https://example.com/oauth/callback | -| `authorize_url` | *str* | :heavy_check_mark: | N/A | https://example.com/authorize | -| `token_fetch_url` | *str* | :heavy_check_mark: | N/A | https://example.com/oauth/token | -| `user_info_url` | *str* | :heavy_check_mark: | N/A | https://example.com/userinfo | -| `discovery_url` | *str* | :heavy_check_mark: | N/A | | -| `token_introspection_url` | *str* | :heavy_check_mark: | N/A | | -| `created_at` | *int* | :heavy_check_mark: | Unix timestamp of creation.
| 1609459200 | -| `updated_at` | *int* | :heavy_check_mark: | Unix timestamp of last update.
| 1612137600 | -| `client_secret` | *Optional[str]* | :heavy_minus_sign: | Empty if public client.
| secretXYZ123 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `object` | [models.OAuthApplicationWithSecretObject](../models/oauthapplicationwithsecretobject.md) | :heavy_check_mark: | N/A | oauth_application | +| `id` | *str* | :heavy_check_mark: | N/A | oauth_app_1234 | +| `instance_id` | *str* | :heavy_check_mark: | N/A | instance_5678 | +| `name` | *str* | :heavy_check_mark: | N/A | Example OAuth App | +| `client_id` | *str* | :heavy_check_mark: | N/A | client_12345 | +| `public` | *bool* | :heavy_check_mark: | N/A | false | +| `scopes` | *str* | :heavy_check_mark: | N/A | profile email | +| `redirect_uris` | List[*str*] | :heavy_check_mark: | N/A | | +| ~~`callback_url`~~ | *str* | :heavy_check_mark: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | https://example.com/oauth/callback | +| `authorize_url` | *str* | :heavy_check_mark: | N/A | https://example.com/authorize | +| `token_fetch_url` | *str* | :heavy_check_mark: | N/A | https://example.com/oauth/token | +| `user_info_url` | *str* | :heavy_check_mark: | N/A | https://example.com/userinfo | +| `discovery_url` | *str* | :heavy_check_mark: | N/A | | +| `token_introspection_url` | *str* | :heavy_check_mark: | N/A | | +| `created_at` | *int* | :heavy_check_mark: | Unix timestamp of creation.
| 1609459200 | +| `updated_at` | *int* | :heavy_check_mark: | Unix timestamp of last update.
| 1612137600 | +| `client_secret` | *Optional[str]* | :heavy_minus_sign: | Empty if public client.
| secretXYZ123 | \ No newline at end of file diff --git a/docs/models/otp.md b/docs/models/otp.md index 0069b596..324a9084 100644 --- a/docs/models/otp.md +++ b/docs/models/otp.md @@ -7,5 +7,6 @@ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | `status` | [models.VerificationStatus](../models/verificationstatus.md) | :heavy_check_mark: | N/A | verified | | `strategy` | [models.Strategy](../models/strategy.md) | :heavy_check_mark: | N/A | email_code | -| `attempts` | *int* | :heavy_check_mark: | N/A | 1 | -| `expire_at` | *int* | :heavy_check_mark: | N/A | 1615462399 | \ No newline at end of file +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | 1 | +| `expire_at` | *Nullable[int]* | :heavy_check_mark: | N/A | 1615462399 | +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/passkey.md b/docs/models/passkey.md index f04d2e4a..e920cfa6 100644 --- a/docs/models/passkey.md +++ b/docs/models/passkey.md @@ -7,6 +7,8 @@ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | | `status` | [models.PasskeyVerificationStatus](../models/passkeyverificationstatus.md) | :heavy_check_mark: | N/A | verified | | `strategy` | [models.PasskeyVerificationStrategy](../models/passkeyverificationstrategy.md) | :heavy_check_mark: | N/A | passkey | +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | | +| `expire_at` | *Nullable[int]* | :heavy_check_mark: | N/A | | | `nonce` | [Optional[models.Nonce]](../models/nonce.md) | :heavy_minus_sign: | N/A | nonce_value | -| `attempts` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | -| `expire_at` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `message` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/saml.md b/docs/models/saml.md index dd2eb1e5..0b325069 100644 --- a/docs/models/saml.md +++ b/docs/models/saml.md @@ -9,5 +9,6 @@ | `strategy` | [models.SAMLVerificationStrategy](../models/samlverificationstrategy.md) | :heavy_check_mark: | N/A | saml | | `external_verification_redirect_url` | *Nullable[str]* | :heavy_check_mark: | N/A | https://example.com/saml_callback | | `expire_at` | *int* | :heavy_check_mark: | N/A | 1622852400 | +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | | | `error` | [OptionalNullable[models.VerificationError]](../models/verificationerror.md) | :heavy_minus_sign: | N/A | | -| `attempts` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/ticket.md b/docs/models/ticket.md index 8ae69b47..63173d1e 100644 --- a/docs/models/ticket.md +++ b/docs/models/ticket.md @@ -7,5 +7,6 @@ | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | `status` | [models.TicketVerificationStatus](../models/ticketverificationstatus.md) | :heavy_check_mark: | N/A | verified | | `strategy` | [models.TicketVerificationStrategy](../models/ticketverificationstrategy.md) | :heavy_check_mark: | N/A | ticket | -| `attempts` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | -| `expire_at` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | | +| `expire_at` | *Nullable[int]* | :heavy_check_mark: | N/A | | +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/totp.md b/docs/models/totp.md deleted file mode 100644 index 4a9b7cd1..00000000 --- a/docs/models/totp.md +++ /dev/null @@ -1,16 +0,0 @@ -# Totp - -A TOTP (Time-based One-Time Password) - - -## Fields - -| Field | Type | Required | Description | -| -------------------- | -------------------- | -------------------- | -------------------- | -| `object` | *str* | :heavy_check_mark: | N/A | -| `id` | *str* | :heavy_check_mark: | N/A | -| `secret` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `uri` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `verified` | *bool* | :heavy_check_mark: | N/A | -| `backup_codes` | List[*str*] | :heavy_minus_sign: | N/A | -| `__pydantic_extra__` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/updateoauthapplicationrequestbody.md b/docs/models/updateoauthapplicationrequestbody.md index 7e343770..42921ed9 100644 --- a/docs/models/updateoauthapplicationrequestbody.md +++ b/docs/models/updateoauthapplicationrequestbody.md @@ -5,6 +5,8 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `name` | *Optional[str]* | :heavy_minus_sign: | The new name of the OAuth application | Updated OAuth App Name | -| `callback_url` | *Optional[str]* | :heavy_minus_sign: | The new callback URL of the 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 private_metadata | \ No newline at end of file +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The new name of the OAuth application | Updated OAuth App Name | +| `redirect_uris` | List[*str*] | :heavy_minus_sign: | An array of redirect URIs of the new OAuth application | | +| ~~`callback_url`~~ | *OptionalNullable[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

The new callback URL of the OAuth application | https://example.com/oauth/callback | +| `scopes` | *OptionalNullable[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 private_metadata | +| `public` | *Optional[bool]* | :heavy_minus_sign: | If true, this client is public and you can use the Proof Key of Code Exchange (PKCE) flow. | | \ No newline at end of file diff --git a/docs/models/verificationadmin.md b/docs/models/verificationadmin.md index 70db0947..34da371d 100644 --- a/docs/models/verificationadmin.md +++ b/docs/models/verificationadmin.md @@ -7,5 +7,6 @@ | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | `status` | [models.AdminVerificationPhoneNumberStatus](../models/adminverificationphonenumberstatus.md) | :heavy_check_mark: | N/A | verified | | `strategy` | [models.AdminVerificationStrategy](../models/adminverificationstrategy.md) | :heavy_check_mark: | N/A | admin | -| `attempts` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 0 | -| `expire_at` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 1620000000 | \ No newline at end of file +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | 0 | +| `expire_at` | *Nullable[int]* | :heavy_check_mark: | N/A | 1620000000 | +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/verificationotp.md b/docs/models/verificationotp.md index 00551178..48324395 100644 --- a/docs/models/verificationotp.md +++ b/docs/models/verificationotp.md @@ -7,5 +7,6 @@ | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | | `status` | [models.OTPVerificationStatus](../models/otpverificationstatus.md) | :heavy_check_mark: | N/A | verified | | `strategy` | [models.OTPVerificationStrategy](../models/otpverificationstrategy.md) | :heavy_check_mark: | N/A | email_code | -| `attempts` | *int* | :heavy_check_mark: | N/A | 1 | -| `expire_at` | *int* | :heavy_check_mark: | N/A | 1615462399 | \ No newline at end of file +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | 1 | +| `expire_at` | *Nullable[int]* | :heavy_check_mark: | N/A | 1615462399 | +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/web3signature.md b/docs/models/web3signature.md index db108ab4..6c2dc23e 100644 --- a/docs/models/web3signature.md +++ b/docs/models/web3signature.md @@ -7,7 +7,8 @@ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | | `status` | [models.Web3SignatureVerificationStatus](../models/web3signatureverificationstatus.md) | :heavy_check_mark: | N/A | verified | | `strategy` | [models.Web3SignatureVerificationStrategy](../models/web3signatureverificationstrategy.md) | :heavy_check_mark: | N/A | web3_metamask_signature | +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | | +| `expire_at` | *Nullable[int]* | :heavy_check_mark: | N/A | | | `nonce` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | nonce_value | | `message` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | -| `attempts` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | -| `expire_at` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/web3walletverificationadmin.md b/docs/models/web3walletverificationadmin.md index bb11c86f..7a9d9ab3 100644 --- a/docs/models/web3walletverificationadmin.md +++ b/docs/models/web3walletverificationadmin.md @@ -7,5 +7,6 @@ | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | | `status` | [models.AdminVerificationWeb3WalletStatus](../models/adminverificationweb3walletstatus.md) | :heavy_check_mark: | N/A | verified | | `strategy` | [models.AdminVerificationWeb3WalletStrategy](../models/adminverificationweb3walletstrategy.md) | :heavy_check_mark: | N/A | admin | -| `attempts` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 0 | -| `expire_at` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 1620000000 | \ No newline at end of file +| `attempts` | *Nullable[int]* | :heavy_check_mark: | N/A | 0 | +| `expire_at` | *Nullable[int]* | :heavy_check_mark: | N/A | 1620000000 | +| `verified_at_client` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/sdks/actortokens/README.md b/docs/sdks/actortokens/README.md index af06c333..04d6697e 100644 --- a/docs/sdks/actortokens/README.md +++ b/docs/sdks/actortokens/README.md @@ -25,8 +25,6 @@ with Clerk( res = clerk.actor_tokens.create(request={ "user_id": "user_1a2b3c", "actor": {}, - "expires_in_seconds": 3600, - "session_max_duration_in_seconds": 1800, }) assert res is not None diff --git a/docs/sdks/allowlistblocklist/README.md b/docs/sdks/allowlistblocklist/README.md index 491f2bfb..c83520b6 100644 --- a/docs/sdks/allowlistblocklist/README.md +++ b/docs/sdks/allowlistblocklist/README.md @@ -64,7 +64,6 @@ with Clerk( res = clerk.allowlist_blocklist.create_allowlist_identifier(request={ "identifier": "user@example.com", - "notify": True, }) assert res is not None diff --git a/docs/sdks/betafeatures/README.md b/docs/sdks/betafeatures/README.md index cf9751a3..14707a29 100644 --- a/docs/sdks/betafeatures/README.md +++ b/docs/sdks/betafeatures/README.md @@ -23,7 +23,6 @@ with Clerk( ) as clerk: res = clerk.beta_features.update_instance_settings(request={ - "restricted_to_allowlist": False, "from_email_address": "noreply", "progressive_sign_up": True, "session_token_template": "defaultSessionToken", diff --git a/docs/sdks/clients/README.md b/docs/sdks/clients/README.md index b623dfe1..f5a28135 100644 --- a/docs/sdks/clients/README.md +++ b/docs/sdks/clients/README.md @@ -29,7 +29,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.clients.list(limit=20, offset=10) + res = clerk.clients.list() assert res is not None diff --git a/docs/sdks/invitations/README.md b/docs/sdks/invitations/README.md index f1e2ebac..fef8abd8 100644 --- a/docs/sdks/invitations/README.md +++ b/docs/sdks/invitations/README.md @@ -35,8 +35,6 @@ with Clerk( }, "redirect_url": "https://example.com/welcome", - "notify": True, - "ignore_existing": True, "expires_in_days": 486589, "template_slug": clerk_backend_api.TemplateSlug.WAITLIST_INVITATION, }) @@ -80,7 +78,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.invitations.list(limit=20, offset=10, status=clerk_backend_api.ListInvitationsQueryParamStatus.PENDING, query="") + res = clerk.invitations.list(status=clerk_backend_api.ListInvitationsQueryParamStatus.PENDING, query="") assert res is not None @@ -132,8 +130,6 @@ with Clerk( "key": "", }, "redirect_url": "https://dreary-advancement.net/", - "notify": True, - "ignore_existing": False, "expires_in_days": 123536, }, { @@ -142,8 +138,6 @@ with Clerk( "key": "", }, "redirect_url": "https://shrill-jet.net/", - "notify": True, - "ignore_existing": False, "expires_in_days": 665767, }, ]) diff --git a/docs/sdks/oauthapplicationssdk/README.md b/docs/sdks/oauthapplicationssdk/README.md index efafc5a6..15c18bdc 100644 --- a/docs/sdks/oauthapplicationssdk/README.md +++ b/docs/sdks/oauthapplicationssdk/README.md @@ -28,7 +28,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.oauth_applications.list(limit=20, offset=10) + res = clerk.oauth_applications.list() assert res is not None @@ -73,8 +73,11 @@ with Clerk( res = clerk.oauth_applications.create(request={ "name": "Example App", + "redirect_uris": [ + "", + "", + ], "callback_url": "https://example.com/oauth/callback", - "scopes": "profile email public_metadata", "public": True, }) @@ -156,7 +159,11 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.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") + res = clerk.oauth_applications.update(oauth_application_id="oauth_app_67890", name="Updated OAuth App Name", redirect_uris=[ + "", + "", + "", + ], callback_url="https://example.com/oauth/callback", public=False) assert res is not None @@ -170,9 +177,11 @@ with Clerk( | Parameter | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `oauth_application_id` | *str* | :heavy_check_mark: | The ID of the OAuth application to update | oauth_app_67890 | -| `name` | *Optional[str]* | :heavy_minus_sign: | The new name of the OAuth application | Updated OAuth App Name | -| `callback_url` | *Optional[str]* | :heavy_minus_sign: | The new callback URL of the 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 private_metadata | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The new name of the OAuth application | Updated OAuth App Name | +| `redirect_uris` | List[*str*] | :heavy_minus_sign: | An array of redirect URIs of the new OAuth application | | +| `callback_url` | *OptionalNullable[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

The new callback URL of the OAuth application | https://example.com/oauth/callback | +| `scopes` | *OptionalNullable[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 private_metadata | +| `public` | *Optional[bool]* | :heavy_minus_sign: | If true, this client is public and you can use the Proof Key of Code Exchange (PKCE) flow. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -183,7 +192,7 @@ with Clerk( | Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| models.ClerkErrors | 403, 404, 422 | application/json | +| models.ClerkErrors | 400, 403, 404, 422 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | ## delete diff --git a/docs/sdks/organizationdomainssdk/README.md b/docs/sdks/organizationdomainssdk/README.md index 6e04d110..893618cc 100644 --- a/docs/sdks/organizationdomainssdk/README.md +++ b/docs/sdks/organizationdomainssdk/README.md @@ -65,7 +65,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_domains.list(organization_id="", limit=20, offset=10, verified="", enrollment_mode="") + res = clerk.organization_domains.list(organization_id="", verified="", enrollment_mode="") assert res is not None diff --git a/docs/sdks/organizationinvitationssdk/README.md b/docs/sdks/organizationinvitationssdk/README.md index 3471e582..745e91dd 100644 --- a/docs/sdks/organizationinvitationssdk/README.md +++ b/docs/sdks/organizationinvitationssdk/README.md @@ -32,7 +32,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_invitations.get_all(limit=20, offset=10, order_by="-created_at", status=clerk_backend_api.ListInstanceOrganizationInvitationsQueryParamStatus.ACCEPTED, query="") + res = clerk.organization_invitations.get_all(status=clerk_backend_api.ListInstanceOrganizationInvitationsQueryParamStatus.ACCEPTED, query="") assert res is not None @@ -149,7 +149,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_invitations.list(organization_id="org_12345", limit=20, offset=10, status=clerk_backend_api.ListOrganizationInvitationsQueryParamStatus.PENDING) + res = clerk.organization_invitations.list(organization_id="org_12345", status=clerk_backend_api.ListOrganizationInvitationsQueryParamStatus.PENDING) assert res is not None @@ -254,7 +254,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_invitations.list_pending(organization_id="org_12345", limit=20, offset=10) + res = clerk.organization_invitations.list_pending(organization_id="org_12345") assert res is not None diff --git a/docs/sdks/organizationmembershipssdk/README.md b/docs/sdks/organizationmembershipssdk/README.md index 579c37ae..00f24d81 100644 --- a/docs/sdks/organizationmembershipssdk/README.md +++ b/docs/sdks/organizationmembershipssdk/README.md @@ -67,7 +67,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_memberships.list(organization_id="org_789", limit=20, offset=10, order_by="+created_at") + res = clerk.organization_memberships.list(organization_id="org_789", order_by="+created_at") assert res is not None @@ -242,7 +242,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organization_memberships.get_all(limit=20, offset=10, order_by="") + res = clerk.organization_memberships.get_all(order_by="") assert res is not None diff --git a/docs/sdks/organizationssdk/README.md b/docs/sdks/organizationssdk/README.md index 98a6ceeb..579be3e5 100644 --- a/docs/sdks/organizationssdk/README.md +++ b/docs/sdks/organizationssdk/README.md @@ -33,7 +33,9 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.organizations.list(limit=20, offset=10, include_members_count=False, query="clerk", order_by="-name") + res = clerk.organizations.list(include_members_count=False, query="clerk", organization_id=[ + "-name", + ]) assert res is not None @@ -50,7 +52,8 @@ with Clerk( | `offset` | *Optional[int]* | :heavy_minus_sign: | Skip the first `offset` results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with `limit`. | 10 | | `include_members_count` | *Optional[bool]* | :heavy_minus_sign: | Flag to denote whether the member counts of each organization should be included in the response or not. | false | | `query` | *Optional[str]* | :heavy_minus_sign: | Returns organizations with ID, name, or slug that match the given query.
Uses exact match for organization ID and partial match for name and slug. | clerk | -| `order_by` | *Optional[str]* | :heavy_minus_sign: | Allows to return organizations in a particular order.
At the moment, you can order the returned organizations either by their `name`, `created_at` or `members_count`.
In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by.
For example, if you want organizations to be returned in descending order according to their `created_at` property, you can use `-created_at`.
If you don't use `+` or `-`, then `+` is implied.
Defaults to `-created_at`. | -name | +| `organization_id` | List[*str*] | :heavy_minus_sign: | Returns organizations with the organization ids specified.
Any organization ids not found are ignored.
For each organization id, the `+` and `-` can be
prepended to the id, which denote whether the
respective organization should be included or
excluded from the result set.
Accepts up to 100 organization ids.
Example: ?organization_id=+org_1&organization_id=-org_2 | -name | +| `order_by` | *Optional[str]* | :heavy_minus_sign: | Allows to return organizations in a particular order.
At the moment, you can order the returned organizations either by their `name`, `created_at` or `members_count`.
In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by.
For example, if you want organizations to be returned in descending order according to their `created_at` property, you can use `-created_at`.
If you don't use `+` or `-`, then `+` is implied.
Defaults to `-created_at`. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/samlconnectionssdk/README.md b/docs/sdks/samlconnectionssdk/README.md index 512dbaa6..0ee2c6b1 100644 --- a/docs/sdks/samlconnectionssdk/README.md +++ b/docs/sdks/samlconnectionssdk/README.md @@ -26,7 +26,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.saml_connections.list(limit=20, offset=10, organization_id=[ + res = clerk.saml_connections.list(organization_id=[ "", "", "", diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md index 97d2d133..356e136c 100644 --- a/docs/sdks/sessions/README.md +++ b/docs/sdks/sessions/README.md @@ -35,7 +35,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.sessions.list(client_id="client_123", user_id="user_456", status=clerk_backend_api.QueryParamStatus.ACTIVE, limit=20, offset=10) + res = clerk.sessions.list(client_id="client_123", user_id="user_456", status=clerk_backend_api.QueryParamStatus.ACTIVE) assert res is not None @@ -70,7 +70,8 @@ with Clerk( Create a new active session for the provided user ID. -This operation is only available for Clerk Development instances. +**This operation is intended only for use in testing, and is not available for production instances.** If you are looking to generate a user session from the backend, +we recommend using the [Sign-in Tokens](https://clerk.com/docs/reference/backend-api/tag/Sign-in-Tokens#operation/CreateSignInToken) resource instead. ### Example Usage diff --git a/docs/sdks/signintokens/README.md b/docs/sdks/signintokens/README.md index 9ae3e73b..f360ab7a 100644 --- a/docs/sdks/signintokens/README.md +++ b/docs/sdks/signintokens/README.md @@ -25,7 +25,6 @@ with Clerk( res = clerk.sign_in_tokens.create(request={ "user_id": "user_12345", - "expires_in_seconds": 2592000, }) assert res is not None diff --git a/docs/sdks/users/README.md b/docs/sdks/users/README.md index e44bcda3..01e0d07d 100644 --- a/docs/sdks/users/README.md +++ b/docs/sdks/users/README.md @@ -30,7 +30,6 @@ The user object represents a user that has successfully signed up to your applic * [delete_backup_codes](#delete_backup_codes) - Disable all user's Backup codes * [delete_passkey](#delete_passkey) - Delete a user passkey * [delete_web3_wallet](#delete_web3_wallet) - Delete a user web3 wallet -* [create_totp](#create_totp) - Create a TOTP for a user * [delete_totp](#delete_totp) - Delete all the user's TOTPs * [delete_external_account](#delete_external_account) - Delete External Account @@ -48,21 +47,40 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.list(email_address=[ - "test@example.com", - ], phone_number=[ - "+12345678901", - ], external_id=[ - "external-id-123", - ], username=[ - "user123", - ], web3_wallet=[ - "0x123456789abcdef0x123456789abcdef", - ], user_id=[ - "user-id-123", - ], organization_id=[ - "org-id-123", - ], query="John", email_address_query="", phone_number_query="", username_query="", name_query="", last_active_at_before=1700690400000, last_active_at_after=1700690400000, last_active_at_since=1700690400000, created_at_before=1730160000000, created_at_after=1730160000000, limit=20, offset=10, order_by="-created_at") + res = clerk.users.list(request={ + "email_address": [ + "test@example.com", + ], + "phone_number": [ + "+12345678901", + ], + "external_id": [ + "external-id-123", + ], + "username": [ + "user123", + ], + "web3_wallet": [ + "0x123456789abcdef0x123456789abcdef", + ], + "user_id": [ + "user-id-123", + ], + "organization_id": [ + "org-id-123", + ], + "query": "John", + "email_address_query": "", + "phone_number_query": "", + "username_query": "", + "name_query": "", + "banned": False, + "last_active_at_before": 1700690400000, + "last_active_at_after": 1700690400000, + "last_active_at_since": 1700690400000, + "created_at_before": 1730160000000, + "created_at_after": 1730160000000, + }) assert res is not None @@ -73,29 +91,10 @@ with Clerk( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `email_address` | List[*str*] | :heavy_minus_sign: | Returns users with the specified email addresses.
Accepts up to 100 email addresses.
Any email addresses not found are ignored. | [
"test@example.com"
] | -| `phone_number` | List[*str*] | :heavy_minus_sign: | Returns users with the specified phone numbers.
Accepts up to 100 phone numbers.
Any phone numbers not found are ignored. | [
"+12345678901"
] | -| `external_id` | List[*str*] | :heavy_minus_sign: | Returns users with the specified external ids.
For each external id, the `+` and `-` can be
prepended to the id, which denote whether the
respective external id should be included or
excluded from the result set.
Accepts up to 100 external ids.
Any external ids not found are ignored. | [
"external-id-123"
] | -| `username` | List[*str*] | :heavy_minus_sign: | Returns users with the specified usernames.
Accepts up to 100 usernames.
Any usernames not found are ignored. | [
"user123"
] | -| `web3_wallet` | List[*str*] | :heavy_minus_sign: | Returns users with the specified web3 wallet addresses.
Accepts up to 100 web3 wallet addresses.
Any web3 wallet addressed not found are ignored. | [
"0x123456789abcdef0x123456789abcdef"
] | -| `user_id` | List[*str*] | :heavy_minus_sign: | Returns users with the user ids specified.
For each user id, the `+` and `-` can be
prepended to the id, which denote whether the
respective user id should be included or
excluded from the result set.
Accepts up to 100 user ids.
Any user ids not found are ignored. | [
"user-id-123"
] | -| `organization_id` | List[*str*] | :heavy_minus_sign: | Returns users that have memberships to the
given organizations.
For each organization id, the `+` and `-` can be
prepended to the id, which denote whether the
respective organization should be included or
excluded from the result set.
Accepts up to 100 organization ids. | [
"org-id-123"
] | -| `query` | *Optional[str]* | :heavy_minus_sign: | Returns users that match the given query.
For possible matches, we check the email addresses, phone numbers, usernames, web3 wallets, user ids, first and last names.
The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well. | John | -| `email_address_query` | *Optional[str]* | :heavy_minus_sign: | Returns users with emails that match the given query, via case-insensitive partial match.
For example, `email_address_query=ello` will match a user with the email `HELLO@example.com`. | | -| `phone_number_query` | *Optional[str]* | :heavy_minus_sign: | Returns users with phone numbers that match the given query, via case-insensitive partial match.
For example, `phone_number_query=555` will match a user with the phone number `+1555xxxxxxx`. | | -| `username_query` | *Optional[str]* | :heavy_minus_sign: | Returns users with usernames that match the given query, via case-insensitive partial match.
For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`. | | -| `name_query` | *Optional[str]* | :heavy_minus_sign: | Returns users with names that match the given query, via case-insensitive partial match. | | -| `last_active_at_before` | *Optional[int]* | :heavy_minus_sign: | Returns users whose last session activity was before the given date (with millisecond precision).
Example: use 1700690400000 to retrieve users whose last session activity was before 2023-11-23. | 1700690400000 | -| `last_active_at_after` | *Optional[int]* | :heavy_minus_sign: | Returns users whose last session activity was after the given date (with millisecond precision).
Example: use 1700690400000 to retrieve users whose last session activity was after 2023-11-23. | 1700690400000 | -| `last_active_at_since` | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Returns users that had session activity since the given date.
Example: use 1700690400000 to retrieve users that had session activity from 2023-11-23 until the current day.
Deprecated in favor of `last_active_at_after`. | 1700690400000 | -| `created_at_before` | *Optional[int]* | :heavy_minus_sign: | Returns users who have been created before the given date (with millisecond precision).
Example: use 1730160000000 to retrieve users who have been created before 2024-10-29. | 1730160000000 | -| `created_at_after` | *Optional[int]* | :heavy_minus_sign: | Returns users who have been created after the given date (with millisecond precision).
Example: use 1730160000000 to retrieve users who have been created after 2024-10-29. | 1730160000000 | -| `limit` | *Optional[int]* | :heavy_minus_sign: | Applies a limit to the number of results returned.
Can be used for paginating the results together with `offset`. | 20 | -| `offset` | *Optional[int]* | :heavy_minus_sign: | Skip the first `offset` results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with `limit`. | 10 | -| `order_by` | *Optional[str]* | :heavy_minus_sign: | Allows to return users in a particular order.
At the moment, you can order the returned users by their `created_at`,`updated_at`,`email_address`,`web3wallet`,`first_name`,`last_name`,`phone_number`,`username`,`last_active_at`,`last_sign_in_at`.
In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by.
For example, if you want users to be returned in descending order according to their `created_at` property, you can use `-created_at`.
If you don't use `+` or `-`, then `+` is implied. We only support one `order_by` parameter, and if multiple `order_by` parameters are provided, we will only keep the first one. For example,
if you pass `order_by=username&order_by=created_at`, we will consider only the first `order_by` parameter, which is `username`. The `created_at` parameter will be ignored in this case. | | -| `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 | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `request` | [models.GetUserListRequest](../../models/getuserlistrequest.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. | ### Response @@ -220,7 +219,7 @@ with Clerk( "0x123456789abcdef", ], user_id=[ "user-id-123", - ], query="John Doe", email_address_query="", phone_number_query="", username_query="") + ], query="John Doe", email_address_query="", phone_number_query="", username_query="", banned=True) assert res is not None @@ -243,6 +242,7 @@ with Clerk( | `email_address_query` | *Optional[str]* | :heavy_minus_sign: | Counts users with emails that match the given query, via case-insensitive partial match.
For example, `email_address_query=ello` will match a user with the email `HELLO@example.com`,
and will be included in the resulting count. | | | `phone_number_query` | *Optional[str]* | :heavy_minus_sign: | Counts users with phone numbers that match the given query, via case-insensitive partial match.
For example, `phone_number_query=555` will match a user with the phone number `+1555xxxxxxx`,
and will be included in the resulting count. | | | `username_query` | *Optional[str]* | :heavy_minus_sign: | Counts users with usernames that match the given query, via case-insensitive partial match.
For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`,
and will be included in the resulting count. | | +| `banned` | *Optional[bool]* | :heavy_minus_sign: | Counts users which are either banned (`banned=true`) or not banned (`banned=false`). | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -320,7 +320,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.update(user_id="usr_1", external_id="ext_123", first_name="Jane", last_name="Doe", primary_email_address_id="eml_12345", notify_primary_email_address_changed=True, primary_phone_number_id="phn_67890", primary_web3_wallet_id="wlt_123", username="janedoe", profile_image_id="img_789", password="secretPass123!", password_digest="$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc", password_hasher="", skip_password_checks=False, sign_out_of_other_sessions=True, totp_secret="ABCD1234EFGH5678", backup_codes=[ + res = clerk.users.update(user_id="usr_1", external_id="ext_123", first_name="Jane", last_name="Doe", primary_email_address_id="eml_12345", primary_phone_number_id="phn_67890", primary_web3_wallet_id="wlt_123", username="janedoe", profile_image_id="img_789", password="secretPass123!", password_digest="$argon2i$v=19$m=4096,t=3,p=1$4t6CL3P7YiHBtwESXawI8Hm20zJj4cs7/4/G3c187e0$m7RQFczcKr5bIR0IIxbpO2P0tyrLjf3eUW3M3QSwnLc", password_hasher="", skip_password_checks=False, sign_out_of_other_sessions=True, totp_secret="ABCD1234EFGH5678", backup_codes=[ "123456", "654321", ], public_metadata={ @@ -781,7 +781,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.get_organization_memberships(user_id="usr_1234567890", limit=20, offset=10) + res = clerk.users.get_organization_memberships(user_id="usr_1234567890") assert res is not None @@ -824,7 +824,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.users.get_organization_invitations(user_id="", limit=20, offset=10, status=clerk_backend_api.UsersGetOrganizationInvitationsQueryParamStatus.PENDING) + res = clerk.users.get_organization_invitations(user_id="", status=clerk_backend_api.UsersGetOrganizationInvitationsQueryParamStatus.PENDING) assert res is not None @@ -1106,48 +1106,6 @@ with Clerk( | models.ClerkErrors | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | -## create_totp - -Creates a TOTP (Time-based One-Time Password) for a given user, returning both the TOTP secret and the URI. - - -### Example Usage - -```python -from clerk_backend_api import Clerk - -with Clerk( - bearer_auth="", -) as clerk: - - res = clerk.users.create_totp(user_id="") - - assert res is not None - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `user_id` | *str* | :heavy_check_mark: | The ID of the user for whom the TOTP is being created. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[models.Totp](../../models/totp.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| models.ClerkErrors | 403, 404 | application/json | -| models.ClerkErrors | 500 | application/json | -| models.SDKError | 4XX, 5XX | \*/\* | - ## delete_totp Deletes all of the user's TOTPs. diff --git a/docs/sdks/waitlistentriessdk/README.md b/docs/sdks/waitlistentriessdk/README.md index 67adefb6..441c8ecb 100644 --- a/docs/sdks/waitlistentriessdk/README.md +++ b/docs/sdks/waitlistentriessdk/README.md @@ -24,7 +24,7 @@ with Clerk( bearer_auth="", ) as clerk: - res = clerk.waitlist_entries.list_waitlist_entries(limit=20, offset=10, query="", status=clerk_backend_api.ListWaitlistEntriesQueryParamStatus.COMPLETED, order_by="-created_at") + res = clerk.waitlist_entries.list_waitlist_entries(query="", status=clerk_backend_api.ListWaitlistEntriesQueryParamStatus.COMPLETED) assert res is not None @@ -39,7 +39,7 @@ with Clerk( | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `limit` | *Optional[int]* | :heavy_minus_sign: | Applies a limit to the number of results returned.
Can be used for paginating the results together with `offset`. | 20 | | `offset` | *Optional[int]* | :heavy_minus_sign: | Skip the first `offset` results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with `limit`. | 10 | -| `query` | *Optional[str]* | :heavy_minus_sign: | Filter waitlist entries by email address | | +| `query` | *Optional[str]* | :heavy_minus_sign: | Filter waitlist entries by `email_address` or `id` | | | `status` | [Optional[models.ListWaitlistEntriesQueryParamStatus]](../../models/listwaitlistentriesqueryparamstatus.md) | :heavy_minus_sign: | Filter waitlist entries by their status | | | `order_by` | *Optional[str]* | :heavy_minus_sign: | Specify the order of results. Supported values are:
- `created_at`
- `email_address`
- `invited_at`

Use `+` for ascending or `-` for descending order. Defaults to `-created_at`. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | diff --git a/poetry.lock b/poetry.lock index 827352c8..e5fce408 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. [[package]] name = "annotated-types" @@ -32,7 +32,7 @@ typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} [package.extras] doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] -test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.21.0b1)"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.21.0b1) ; platform_python_implementation == \"CPython\" and platform_system != \"Windows\""] trio = ["trio (>=0.26.1)"] [[package]] @@ -306,7 +306,7 @@ httpcore = "==1.*" idna = "*" [package.extras] -brotli = ["brotli", "brotlicffi"] +brotli = ["brotli ; platform_python_implementation == \"CPython\"", "brotlicffi ; platform_python_implementation != \"CPython\""] cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] @@ -354,18 +354,6 @@ files = [ [package.extras] colors = ["colorama (>=0.4.6)"] -[[package]] -name = "jsonpath-python" -version = "1.0.6" -description = "A more powerful JSONPath implementation in modern python" -optional = false -python-versions = ">=3.6" -groups = ["main"] -files = [ - {file = "jsonpath-python-1.0.6.tar.gz", hash = "sha256:dd5be4a72d8a2995c3f583cf82bf3cd1a9544cfdabf2d22595b67aff07349666"}, - {file = "jsonpath_python-1.0.6-py3-none-any.whl", hash = "sha256:1e3b78df579f5efc23565293612decee04214609208a2335884b3ee3f786b575"}, -] - [[package]] name = "mccabe" version = "0.7.0" @@ -527,7 +515,7 @@ typing-extensions = ">=4.12.2" [package.extras] email = ["email-validator (>=2.0.0)"] -timezone = ["tzdata"] +timezone = ["tzdata ; python_version >= \"3.9\" and platform_system == \"Windows\""] [[package]] name = "pydantic-core" @@ -678,7 +666,7 @@ colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, - {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, + {version = ">=0.3.6", markers = "python_version == \"3.11\""}, ] isort = ">=4.2.5,<5.13.0 || >5.13.0,<6" mccabe = ">=0.6,<0.8" @@ -821,4 +809,4 @@ typing-extensions = ">=3.7.4" [metadata] lock-version = "2.1" python-versions = ">=3.9" -content-hash = "0d796b7c7dea3f2a5a3325a8febeadfda27afc07d8be3aa409e6788fe61b528c" +content-hash = "d30d4b2c55e005b5669531dca54df265d5eecc44730a789a6a30ca7d57bbd427" diff --git a/pyproject.toml b/pyproject.toml index 56cf2fd0..1e860e48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "clerk-backend-api" -version = "1.7.2" +version = "1.8.0" description = "Python Client SDK for clerk.dev" authors = [{ name = "Clerk" },] readme = "README-PYPI.md" @@ -9,7 +9,6 @@ dependencies = [ "cryptography (>=43.0.1,<44.0.0)", "eval-type-backport >=0.2.0", "httpx >=0.28.1", - "jsonpath-python >=1.0.6", "pydantic >=2.10.3", "pyjwt (>=2.9.0,<3.0.0)", "python-dateutil >=2.8.2", @@ -40,6 +39,7 @@ requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.pytest.ini_options] +asyncio_default_fixture_loop_scope = "function" pythonpath = ["src"] [tool.mypy] diff --git a/src/clerk_backend_api/_hooks/types.py b/src/clerk_backend_api/_hooks/types.py index a075d877..4cf9d8d8 100644 --- a/src/clerk_backend_api/_hooks/types.py +++ b/src/clerk_backend_api/_hooks/types.py @@ -7,16 +7,19 @@ class HookContext: + base_url: str operation_id: str oauth2_scopes: Optional[List[str]] = None security_source: Optional[Union[Any, Callable[[], Any]]] = None def __init__( self, + base_url: str, operation_id: str, oauth2_scopes: Optional[List[str]], security_source: Optional[Union[Any, Callable[[], Any]]], ): + self.base_url = base_url self.operation_id = operation_id self.oauth2_scopes = oauth2_scopes self.security_source = security_source @@ -25,21 +28,30 @@ def __init__( class BeforeRequestContext(HookContext): def __init__(self, hook_ctx: HookContext): super().__init__( - hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source + hook_ctx.base_url, + hook_ctx.operation_id, + hook_ctx.oauth2_scopes, + hook_ctx.security_source, ) class AfterSuccessContext(HookContext): def __init__(self, hook_ctx: HookContext): super().__init__( - hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source + hook_ctx.base_url, + hook_ctx.operation_id, + hook_ctx.oauth2_scopes, + hook_ctx.security_source, ) class AfterErrorContext(HookContext): def __init__(self, hook_ctx: HookContext): super().__init__( - hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source + hook_ctx.base_url, + hook_ctx.operation_id, + hook_ctx.oauth2_scopes, + hook_ctx.security_source, ) diff --git a/src/clerk_backend_api/_version.py b/src/clerk_backend_api/_version.py index 0bea9236..39e2b8cb 100644 --- a/src/clerk_backend_api/_version.py +++ b/src/clerk_backend_api/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "clerk-backend-api" -__version__: str = "1.7.2" +__version__: str = "1.8.0" __openapi_doc_version__: str = "v1" -__gen_version__: str = "2.495.1" -__user_agent__: str = "speakeasy-sdk/python 1.7.2 2.495.1 v1 clerk-backend-api" +__gen_version__: str = "2.515.4" +__user_agent__: str = "speakeasy-sdk/python 1.8.0 2.515.4 v1 clerk-backend-api" try: if __package__ is not None: diff --git a/src/clerk_backend_api/actortokens.py b/src/clerk_backend_api/actortokens.py index a196795f..4fa7d1cd 100644 --- a/src/clerk_backend_api/actortokens.py +++ b/src/clerk_backend_api/actortokens.py @@ -40,6 +40,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -73,13 +75,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateActorToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -89,12 +96,12 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.ActorToken]) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -147,6 +154,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -180,13 +189,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateActorToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -196,12 +210,12 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.ActorToken]) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -248,6 +262,8 @@ def revoke( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeActorTokenRequest( actor_token_id=actor_token_id, @@ -272,13 +288,18 @@ def revoke( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeActorToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -288,12 +309,12 @@ def revoke( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.ActorToken]) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -340,6 +361,8 @@ async def revoke_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeActorTokenRequest( actor_token_id=actor_token_id, @@ -364,13 +387,18 @@ async def revoke_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeActorToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -380,12 +408,12 @@ async def revoke_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.ActorToken]) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/allowlistblocklist.py b/src/clerk_backend_api/allowlistblocklist.py index 30e59552..8c202934 100644 --- a/src/clerk_backend_api/allowlistblocklist.py +++ b/src/clerk_backend_api/allowlistblocklist.py @@ -32,6 +32,8 @@ def list_allowlist_identifiers( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="GET", path="/allowlist_identifiers", @@ -51,13 +53,18 @@ def list_allowlist_identifiers( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListAllowlistIdentifiers", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -67,14 +74,14 @@ def list_allowlist_identifiers( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[List[models.AllowlistIdentifier]] ) if utils.match_response(http_res, ["401", "402"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -119,6 +126,8 @@ async def list_allowlist_identifiers_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="GET", path="/allowlist_identifiers", @@ -138,13 +147,18 @@ async def list_allowlist_identifiers_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListAllowlistIdentifiers", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -154,14 +168,14 @@ async def list_allowlist_identifiers_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[List[models.AllowlistIdentifier]] ) if utils.match_response(http_res, ["401", "402"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -213,6 +227,8 @@ def create_allowlist_identifier( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -246,13 +262,18 @@ def create_allowlist_identifier( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateAllowlistIdentifier", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -262,14 +283,14 @@ def create_allowlist_identifier( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.AllowlistIdentifier] ) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -321,6 +342,8 @@ async def create_allowlist_identifier_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -354,13 +377,18 @@ async def create_allowlist_identifier_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateAllowlistIdentifier", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -370,14 +398,14 @@ async def create_allowlist_identifier_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.AllowlistIdentifier] ) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -429,6 +457,8 @@ def create_blocklist_identifier( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -462,13 +492,18 @@ def create_blocklist_identifier( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateBlocklistIdentifier", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -478,14 +513,14 @@ def create_blocklist_identifier( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.BlocklistIdentifier] ) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -537,6 +572,8 @@ async def create_blocklist_identifier_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -570,13 +607,18 @@ async def create_blocklist_identifier_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateBlocklistIdentifier", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -586,14 +628,14 @@ async def create_blocklist_identifier_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.BlocklistIdentifier] ) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -640,6 +682,8 @@ def delete_blocklist_identifier( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteBlocklistIdentifierRequest( identifier_id=identifier_id, @@ -664,13 +708,18 @@ def delete_blocklist_identifier( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteBlocklistIdentifier", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -680,12 +729,12 @@ def delete_blocklist_identifier( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["402", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -732,6 +781,8 @@ async def delete_blocklist_identifier_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteBlocklistIdentifierRequest( identifier_id=identifier_id, @@ -756,13 +807,18 @@ async def delete_blocklist_identifier_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteBlocklistIdentifier", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -772,12 +828,12 @@ async def delete_blocklist_identifier_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["402", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/allowlistidentifiers.py b/src/clerk_backend_api/allowlistidentifiers.py index 60c12a21..fa574480 100644 --- a/src/clerk_backend_api/allowlistidentifiers.py +++ b/src/clerk_backend_api/allowlistidentifiers.py @@ -34,6 +34,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteAllowlistIdentifierRequest( identifier_id=identifier_id, @@ -58,13 +60,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteAllowlistIdentifier", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -74,12 +81,12 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["402", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -126,6 +133,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteAllowlistIdentifierRequest( identifier_id=identifier_id, @@ -150,13 +159,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteAllowlistIdentifier", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -166,12 +180,12 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["402", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/betafeatures.py b/src/clerk_backend_api/betafeatures.py index 6e5c7192..8132722b 100644 --- a/src/clerk_backend_api/betafeatures.py +++ b/src/clerk_backend_api/betafeatures.py @@ -40,6 +40,8 @@ def update_instance_settings( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -73,13 +75,18 @@ def update_instance_settings( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateInstanceAuthConfig", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -89,14 +96,14 @@ def update_instance_settings( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.InstanceSettings] ) if utils.match_response(http_res, ["402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -148,6 +155,8 @@ async def update_instance_settings_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -181,13 +190,18 @@ async def update_instance_settings_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateInstanceAuthConfig", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -197,14 +211,14 @@ async def update_instance_settings_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.InstanceSettings] ) if utils.match_response(http_res, ["402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -263,6 +277,8 @@ def update_domain( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -298,13 +314,18 @@ def update_domain( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateProductionInstanceDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -314,12 +335,12 @@ def update_domain( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "202", "*"): return if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -378,6 +399,8 @@ async def update_domain_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -413,13 +436,18 @@ async def update_domain_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateProductionInstanceDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -429,12 +457,12 @@ async def update_domain_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "202", "*"): return if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -490,6 +518,8 @@ def change_production_instance_domain( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -525,13 +555,18 @@ def change_production_instance_domain( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ChangeProductionInstanceDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -541,12 +576,12 @@ def change_production_instance_domain( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "202", "*"): return if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -602,6 +637,8 @@ async def change_production_instance_domain_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -637,13 +674,18 @@ async def change_production_instance_domain_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ChangeProductionInstanceDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -653,12 +695,12 @@ async def change_production_instance_domain_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "202", "*"): return if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/blocklistidentifiers_sdk.py b/src/clerk_backend_api/blocklistidentifiers_sdk.py index f30679a5..5b50a1b9 100644 --- a/src/clerk_backend_api/blocklistidentifiers_sdk.py +++ b/src/clerk_backend_api/blocklistidentifiers_sdk.py @@ -32,6 +32,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="GET", path="/blocklist_identifiers", @@ -51,13 +53,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListBlocklistIdentifiers", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -67,14 +74,14 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.BlocklistIdentifiers] ) if utils.match_response(http_res, ["401", "402"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -119,6 +126,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="GET", path="/blocklist_identifiers", @@ -138,13 +147,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListBlocklistIdentifiers", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -154,14 +168,14 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.BlocklistIdentifiers] ) if utils.match_response(http_res, ["401", "402"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/clerk_redirecturls.py b/src/clerk_backend_api/clerk_redirecturls.py index 222399c7..08e0bcea 100644 --- a/src/clerk_backend_api/clerk_redirecturls.py +++ b/src/clerk_backend_api/clerk_redirecturls.py @@ -39,6 +39,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -72,13 +74,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateRedirectURL", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -88,12 +95,12 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.RedirectURL]) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -145,6 +152,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -178,13 +187,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateRedirectURL", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -194,12 +208,12 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.RedirectURL]) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -246,6 +260,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetRedirectURLRequest( id=id, @@ -270,13 +286,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetRedirectURL", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -286,12 +307,12 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.RedirectURL]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -338,6 +359,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetRedirectURLRequest( id=id, @@ -362,13 +385,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetRedirectURL", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -378,12 +406,12 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.RedirectURL]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -430,6 +458,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteRedirectURLRequest( id=id, @@ -454,13 +484,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteRedirectURL", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -470,12 +505,12 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -522,6 +557,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteRedirectURLRequest( id=id, @@ -546,13 +583,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteRedirectURL", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -562,12 +604,12 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/clients.py b/src/clerk_backend_api/clients.py index 1ae986ef..0d5eaa0f 100644 --- a/src/clerk_backend_api/clients.py +++ b/src/clerk_backend_api/clients.py @@ -46,6 +46,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetClientListRequest( limit=limit, @@ -71,13 +73,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetClientList", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -87,14 +94,14 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[List[models.Client]]) if utils.match_response( http_res, ["400", "401", "410", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -148,6 +155,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetClientListRequest( limit=limit, @@ -173,13 +182,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetClientList", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -189,14 +203,14 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[List[models.Client]]) if utils.match_response( http_res, ["400", "401", "410", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -247,6 +261,8 @@ def verify( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, Optional[models.VerifyClientRequestBody]) @@ -274,13 +290,18 @@ def verify( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifyClient", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -290,12 +311,12 @@ def verify( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Client]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -346,6 +367,8 @@ async def verify_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, Optional[models.VerifyClientRequestBody]) @@ -373,13 +396,18 @@ async def verify_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifyClient", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -389,12 +417,12 @@ async def verify_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Client]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -441,6 +469,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetClientRequest( client_id=client_id, @@ -465,13 +495,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetClient", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -481,12 +516,12 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Client]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -533,6 +568,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetClientRequest( client_id=client_id, @@ -557,13 +594,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetClient", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -573,12 +615,12 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Client]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/domains_sdk.py b/src/clerk_backend_api/domains_sdk.py index 4e9c5c7a..4c82872d 100644 --- a/src/clerk_backend_api/domains_sdk.py +++ b/src/clerk_backend_api/domains_sdk.py @@ -35,6 +35,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="GET", path="/domains", @@ -54,13 +56,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListDomains", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -117,6 +124,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="GET", path="/domains", @@ -136,13 +145,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListDomains", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -206,6 +220,8 @@ def add( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, Optional[models.AddDomainRequestBody]) @@ -233,13 +249,18 @@ def add( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="AddDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -249,12 +270,12 @@ def add( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Domain]) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -307,6 +328,8 @@ async def add_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, Optional[models.AddDomainRequestBody]) @@ -334,13 +357,18 @@ async def add_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="AddDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -350,12 +378,12 @@ async def add_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Domain]) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -403,6 +431,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteDomainRequest( domain_id=domain_id, @@ -427,13 +457,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -443,12 +478,12 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -496,6 +531,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteDomainRequest( domain_id=domain_id, @@ -520,13 +557,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -536,12 +578,12 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -601,6 +643,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateDomainRequest( domain_id=domain_id, @@ -637,13 +681,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -653,12 +702,12 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Domain]) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -718,6 +767,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateDomainRequest( domain_id=domain_id, @@ -754,13 +805,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -770,12 +826,12 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Domain]) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/emailaddresses.py b/src/clerk_backend_api/emailaddresses.py index d7d9761d..364ae64e 100644 --- a/src/clerk_backend_api/emailaddresses.py +++ b/src/clerk_backend_api/emailaddresses.py @@ -39,6 +39,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -72,13 +74,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateEmailAddress", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -88,14 +95,14 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.EmailAddress]) if utils.match_response( http_res, ["400", "401", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -147,6 +154,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -180,13 +189,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateEmailAddress", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -196,14 +210,14 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.EmailAddress]) if utils.match_response( http_res, ["400", "401", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -250,6 +264,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetEmailAddressRequest( email_address_id=email_address_id, @@ -274,13 +290,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetEmailAddress", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -290,14 +311,14 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.EmailAddress]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -344,6 +365,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetEmailAddressRequest( email_address_id=email_address_id, @@ -368,13 +391,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetEmailAddress", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -384,14 +412,14 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.EmailAddress]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -438,6 +466,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteEmailAddressRequest( email_address_id=email_address_id, @@ -462,13 +492,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteEmailAddress", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -478,14 +513,14 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -532,6 +567,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteEmailAddressRequest( email_address_id=email_address_id, @@ -556,13 +593,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteEmailAddress", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -572,14 +614,14 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -630,6 +672,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateEmailAddressRequest( email_address_id=email_address_id, @@ -665,13 +709,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateEmailAddress", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -681,14 +730,14 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.EmailAddress]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -739,6 +788,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateEmailAddressRequest( email_address_id=email_address_id, @@ -774,13 +825,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateEmailAddress", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -790,14 +846,14 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.EmailAddress]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/emailandsmstemplates.py b/src/clerk_backend_api/emailandsmstemplates.py index 52d0cda9..d359c837 100644 --- a/src/clerk_backend_api/emailandsmstemplates.py +++ b/src/clerk_backend_api/emailandsmstemplates.py @@ -54,6 +54,8 @@ def upsert( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpsertTemplateRequest( template_type=template_type, @@ -95,13 +97,18 @@ def upsert( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpsertTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -111,14 +118,14 @@ def upsert( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Template]) if utils.match_response( http_res, ["400", "401", "402", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -184,6 +191,8 @@ async def upsert_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpsertTemplateRequest( template_type=template_type, @@ -225,13 +234,18 @@ async def upsert_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpsertTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -241,14 +255,14 @@ async def upsert_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Template]) if utils.match_response( http_res, ["400", "401", "402", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/emailsmstemplates.py b/src/clerk_backend_api/emailsmstemplates.py index 26a5002b..0366483d 100644 --- a/src/clerk_backend_api/emailsmstemplates.py +++ b/src/clerk_backend_api/emailsmstemplates.py @@ -39,6 +39,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetTemplateListRequest( template_type=template_type, @@ -63,13 +65,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetTemplateList", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -79,12 +86,12 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[List[models.Template]]) if utils.match_response(http_res, ["400", "401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -135,6 +142,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetTemplateListRequest( template_type=template_type, @@ -159,13 +168,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetTemplateList", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -175,12 +189,12 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[List[models.Template]]) if utils.match_response(http_res, ["400", "401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -232,6 +246,8 @@ def revert( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevertTemplateRequest( template_type=template_type, @@ -257,13 +273,18 @@ def revert( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevertTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -273,14 +294,14 @@ def revert( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Template]) if utils.match_response( http_res, ["400", "401", "402", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -332,6 +353,8 @@ async def revert_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevertTemplateRequest( template_type=template_type, @@ -357,13 +380,18 @@ async def revert_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevertTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -373,14 +401,14 @@ async def revert_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Template]) if utils.match_response( http_res, ["400", "401", "402", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -432,6 +460,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetTemplateRequest( template_type=template_type, @@ -457,13 +487,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -473,12 +508,12 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Template]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -530,6 +565,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetTemplateRequest( template_type=template_type, @@ -555,13 +592,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -571,12 +613,12 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Template]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -632,6 +674,8 @@ def toggle_template_delivery( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ToggleTemplateDeliveryRequest( template_type=template_type, @@ -667,13 +711,18 @@ def toggle_template_delivery( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ToggleTemplateDelivery", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -683,12 +732,12 @@ def toggle_template_delivery( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Template]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -744,6 +793,8 @@ async def toggle_template_delivery_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ToggleTemplateDeliveryRequest( template_type=template_type, @@ -779,13 +830,18 @@ async def toggle_template_delivery_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ToggleTemplateDelivery", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -795,12 +851,12 @@ async def toggle_template_delivery_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Template]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/instance_settings_sdk.py b/src/clerk_backend_api/instance_settings_sdk.py index 9c6cf3d9..4e6b5c34 100644 --- a/src/clerk_backend_api/instance_settings_sdk.py +++ b/src/clerk_backend_api/instance_settings_sdk.py @@ -32,6 +32,8 @@ def get_instance( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="GET", path="/instance", @@ -51,13 +53,18 @@ def get_instance( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetInstance", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -113,6 +120,8 @@ async def get_instance_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="GET", path="/instance", @@ -132,13 +141,18 @@ async def get_instance_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetInstance", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -201,6 +215,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -230,13 +246,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateInstance", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -246,12 +267,12 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "422", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -303,6 +324,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -332,13 +355,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateInstance", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -348,12 +376,12 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "422", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -405,6 +433,8 @@ def update_restrictions( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -438,13 +468,18 @@ def update_restrictions( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateInstanceRestrictions", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -454,14 +489,14 @@ def update_restrictions( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.InstanceRestrictions] ) if utils.match_response(http_res, ["402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -513,6 +548,8 @@ async def update_restrictions_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -546,13 +583,18 @@ async def update_restrictions_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateInstanceRestrictions", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -562,14 +604,14 @@ async def update_restrictions_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.InstanceRestrictions] ) if utils.match_response(http_res, ["402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -621,6 +663,8 @@ def update_organization_settings( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -656,13 +700,18 @@ def update_organization_settings( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateInstanceOrganizationSettings", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -672,7 +721,7 @@ def update_organization_settings( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationSettings] @@ -680,8 +729,8 @@ def update_organization_settings( if utils.match_response( http_res, ["400", "402", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -733,6 +782,8 @@ async def update_organization_settings_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -768,13 +819,18 @@ async def update_organization_settings_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateInstanceOrganizationSettings", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -784,7 +840,7 @@ async def update_organization_settings_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationSettings] @@ -792,8 +848,8 @@ async def update_organization_settings_async( if utils.match_response( http_res, ["400", "402", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/invitations.py b/src/clerk_backend_api/invitations.py index 72526a12..6d933a93 100644 --- a/src/clerk_backend_api/invitations.py +++ b/src/clerk_backend_api/invitations.py @@ -45,6 +45,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -78,13 +80,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -94,12 +101,12 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Invitation]) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -153,6 +160,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -186,13 +195,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -202,12 +216,12 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Invitation]) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -260,6 +274,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListInvitationsRequest( limit=limit, @@ -287,13 +303,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -359,6 +380,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListInvitationsRequest( limit=limit, @@ -386,13 +409,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -457,6 +485,8 @@ def create_bulk_invitations( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, Optional[List[models.RequestBody]]) @@ -484,13 +514,18 @@ def create_bulk_invitations( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateBulkInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -500,14 +535,14 @@ def create_bulk_invitations( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[List[models.Invitation]] ) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -559,6 +594,8 @@ async def create_bulk_invitations_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, Optional[List[models.RequestBody]]) @@ -586,13 +623,18 @@ async def create_bulk_invitations_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateBulkInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -602,14 +644,14 @@ async def create_bulk_invitations_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[List[models.Invitation]] ) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -659,6 +701,8 @@ def revoke( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeInvitationRequest( invitation_id=invitation_id, @@ -683,13 +727,18 @@ def revoke( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -699,14 +748,14 @@ def revoke( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.InvitationRevoked] ) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -756,6 +805,8 @@ async def revoke_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeInvitationRequest( invitation_id=invitation_id, @@ -780,13 +831,18 @@ async def revoke_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -796,14 +852,14 @@ async def revoke_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.InvitationRevoked] ) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/jwks_sdk.py b/src/clerk_backend_api/jwks_sdk.py index 0edb93ef..f93c6111 100644 --- a/src/clerk_backend_api/jwks_sdk.py +++ b/src/clerk_backend_api/jwks_sdk.py @@ -32,6 +32,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="GET", path="/jwks", @@ -51,13 +53,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetJWKS", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -113,6 +120,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="GET", path="/jwks", @@ -132,13 +141,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetJWKS", oauth2_scopes=[], security_source=self.sdk_configuration.security, diff --git a/src/clerk_backend_api/jwttemplates.py b/src/clerk_backend_api/jwttemplates.py index 9826db1d..0a2057e1 100644 --- a/src/clerk_backend_api/jwttemplates.py +++ b/src/clerk_backend_api/jwttemplates.py @@ -30,6 +30,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="GET", path="/jwt_templates", @@ -49,13 +51,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListJWTTemplates", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -111,6 +118,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="GET", path="/jwt_templates", @@ -130,13 +139,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListJWTTemplates", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -201,6 +215,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -234,13 +250,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateJWTTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -250,12 +271,12 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.JWTTemplate]) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -307,6 +328,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -340,13 +363,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateJWTTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -356,12 +384,12 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.JWTTemplate]) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -408,6 +436,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetJWTTemplateRequest( template_id=template_id, @@ -432,13 +462,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetJWTTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -448,12 +483,12 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.JWTTemplate]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -500,6 +535,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetJWTTemplateRequest( template_id=template_id, @@ -524,13 +561,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetJWTTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -540,12 +582,12 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.JWTTemplate]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -610,6 +652,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateJWTTemplateRequest( template_id=template_id, @@ -652,13 +696,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateJWTTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -668,12 +717,12 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.JWTTemplate]) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -738,6 +787,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateJWTTemplateRequest( template_id=template_id, @@ -780,13 +831,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateJWTTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -796,12 +852,12 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.JWTTemplate]) if utils.match_response(http_res, ["400", "402", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -846,6 +902,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteJWTTemplateRequest( template_id=template_id, @@ -870,13 +928,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteJWTTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -886,12 +949,12 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -936,6 +999,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteJWTTemplateRequest( template_id=template_id, @@ -960,13 +1025,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteJWTTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -976,12 +1046,12 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/miscellaneous.py b/src/clerk_backend_api/miscellaneous.py index 8b1e12ed..9086b86f 100644 --- a/src/clerk_backend_api/miscellaneous.py +++ b/src/clerk_backend_api/miscellaneous.py @@ -39,6 +39,8 @@ def get_interstitial( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetPublicInterstitialRequest( frontend_api=frontend_api, @@ -63,13 +65,18 @@ def get_interstitial( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetPublicInterstitial", oauth2_scopes=[], security_source=None, @@ -130,6 +137,8 @@ async def get_interstitial_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetPublicInterstitialRequest( frontend_api=frontend_api, @@ -154,13 +163,18 @@ async def get_interstitial_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetPublicInterstitial", oauth2_scopes=[], security_source=None, diff --git a/src/clerk_backend_api/models/__init__.py b/src/clerk_backend_api/models/__init__.py index 425804cd..f013b28d 100644 --- a/src/clerk_backend_api/models/__init__.py +++ b/src/clerk_backend_api/models/__init__.py @@ -137,7 +137,6 @@ CreateSignInTokenRequestBodyTypedDict, ) from .createuserop import CreateUserRequestBody, CreateUserRequestBodyTypedDict -from .createusertotpop import CreateUserTOTPRequest, CreateUserTOTPRequestTypedDict from .createwaitlistentryop import ( CreateWaitlistEntryRequestBody, CreateWaitlistEntryRequestBodyTypedDict, @@ -593,7 +592,6 @@ ToggleTemplateDeliveryRequestTypedDict, ) from .totalcount import TotalCount, TotalCountObject, TotalCountTypedDict -from .totp import Totp, TotpTypedDict from .unbanuserop import UnbanUserRequest, UnbanUserRequestTypedDict from .unlockuserop import UnlockUserRequest, UnlockUserRequestTypedDict from .updatedomainop import ( @@ -905,8 +903,6 @@ "CreateSignInTokenRequestBodyTypedDict", "CreateUserRequestBody", "CreateUserRequestBodyTypedDict", - "CreateUserTOTPRequest", - "CreateUserTOTPRequestTypedDict", "CreateWaitlistEntryRequestBody", "CreateWaitlistEntryRequestBodyTypedDict", "DeleteAllowlistIdentifierRequest", @@ -1248,8 +1244,6 @@ "TotalCount", "TotalCountObject", "TotalCountTypedDict", - "Totp", - "TotpTypedDict", "UnbanUserRequest", "UnbanUserRequestTypedDict", "UnlockUserRequest", diff --git a/src/clerk_backend_api/models/createoauthapplicationop.py b/src/clerk_backend_api/models/createoauthapplicationop.py index 9fdcfbe8..967a24cd 100644 --- a/src/clerk_backend_api/models/createoauthapplicationop.py +++ b/src/clerk_backend_api/models/createoauthapplicationop.py @@ -1,37 +1,79 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from clerk_backend_api.types import BaseModel -from typing import Optional -from typing_extensions import NotRequired, TypedDict +from clerk_backend_api.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict class CreateOAuthApplicationRequestBodyTypedDict(TypedDict): name: str r"""The name of the new OAuth application""" - callback_url: NotRequired[str] + redirect_uris: NotRequired[Nullable[List[str]]] + r"""An array of redirect URIs of the new OAuth application""" + callback_url: NotRequired[Nullable[str]] r"""The callback URL of the new OAuth application""" - scopes: NotRequired[str] + scopes: NotRequired[Nullable[str]] r"""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.""" - public: NotRequired[bool] - r"""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. - """ + public: NotRequired[Nullable[bool]] + r"""If true, this client is public and you can use the Proof Key of Code Exchange (PKCE) flow.""" class CreateOAuthApplicationRequestBody(BaseModel): name: str r"""The name of the new OAuth application""" - callback_url: Optional[str] = None + redirect_uris: OptionalNullable[List[str]] = UNSET + r"""An array of redirect URIs of the new OAuth application""" + + callback_url: Annotated[ + OptionalNullable[str], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = UNSET r"""The callback URL of the new OAuth application""" - scopes: Optional[str] = "profile email" + scopes: OptionalNullable[str] = "profile email" r"""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.""" - public: Optional[bool] = None - r"""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. - """ + public: OptionalNullable[bool] = UNSET + r"""If true, this client is public and you can use the Proof Key of Code Exchange (PKCE) flow.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["redirect_uris", "callback_url", "scopes", "public"] + nullable_fields = ["redirect_uris", "callback_url", "scopes", "public"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/clerk_backend_api/models/createusertotpop.py b/src/clerk_backend_api/models/createusertotpop.py deleted file mode 100644 index a6886aac..00000000 --- a/src/clerk_backend_api/models/createusertotpop.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from clerk_backend_api.types import BaseModel -from clerk_backend_api.utils import FieldMetadata, PathParamMetadata -from typing_extensions import Annotated, TypedDict - - -class CreateUserTOTPRequestTypedDict(TypedDict): - user_id: str - r"""The ID of the user for whom the TOTP is being created.""" - - -class CreateUserTOTPRequest(BaseModel): - user_id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""The ID of the user for whom the TOTP is being created.""" diff --git a/src/clerk_backend_api/models/createwaitlistentryop.py b/src/clerk_backend_api/models/createwaitlistentryop.py index 077b0f08..eaf42df4 100644 --- a/src/clerk_backend_api/models/createwaitlistentryop.py +++ b/src/clerk_backend_api/models/createwaitlistentryop.py @@ -10,7 +10,7 @@ class CreateWaitlistEntryRequestBodyTypedDict(TypedDict): email_address: str r"""The email address to add to the waitlist""" notify: NotRequired[bool] - r"""Optional flag which denotes whether an email invitation should be sent to the given email address. + r"""Optional flag which denotes whether a confirmation email should be sent to the given email address. Defaults to `true`. """ @@ -20,6 +20,6 @@ class CreateWaitlistEntryRequestBody(BaseModel): r"""The email address to add to the waitlist""" notify: Optional[bool] = None - r"""Optional flag which denotes whether an email invitation should be sent to the given email address. + r"""Optional flag which denotes whether a confirmation email should be sent to the given email address. Defaults to `true`. """ diff --git a/src/clerk_backend_api/models/emailaddress.py b/src/clerk_backend_api/models/emailaddress.py index df5e82d6..44dd8479 100644 --- a/src/clerk_backend_api/models/emailaddress.py +++ b/src/clerk_backend_api/models/emailaddress.py @@ -67,8 +67,9 @@ class FromOAuthTypedDict(TypedDict): status: FromOAuthVerificationStatus strategy: str expire_at: Nullable[int] + attempts: Nullable[int] error: NotRequired[Nullable[ErrorTypedDict]] - attempts: NotRequired[Nullable[int]] + verified_at_client: NotRequired[Nullable[str]] class FromOAuth(BaseModel): @@ -78,14 +79,16 @@ class FromOAuth(BaseModel): expire_at: Nullable[int] + attempts: Nullable[int] + error: OptionalNullable[Error] = UNSET - attempts: OptionalNullable[int] = UNSET + verified_at_client: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["error", "attempts"] - nullable_fields = ["expire_at", "error", "attempts"] + optional_fields = ["error", "verified_at_client"] + nullable_fields = ["expire_at", "attempts", "error", "verified_at_client"] null_default_fields = [] serialized = handler(self) @@ -124,8 +127,9 @@ class VerificationStrategy(str, Enum, metaclass=utils.OpenEnumMeta): class AdminTypedDict(TypedDict): status: AdminVerificationStatus strategy: VerificationStrategy - attempts: NotRequired[Nullable[int]] - expire_at: NotRequired[Nullable[int]] + attempts: Nullable[int] + expire_at: Nullable[int] + verified_at_client: NotRequired[Nullable[str]] class Admin(BaseModel): @@ -133,14 +137,16 @@ class Admin(BaseModel): strategy: Annotated[VerificationStrategy, PlainValidator(validate_open_enum(False))] - attempts: OptionalNullable[int] = UNSET + attempts: Nullable[int] - expire_at: OptionalNullable[int] = UNSET + expire_at: Nullable[int] + + verified_at_client: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["attempts", "expire_at"] - nullable_fields = ["attempts", "expire_at"] + optional_fields = ["verified_at_client"] + nullable_fields = ["attempts", "expire_at", "verified_at_client"] null_default_fields = [] serialized = handler(self) @@ -190,8 +196,9 @@ class Strategy(str, Enum, metaclass=utils.OpenEnumMeta): class OtpTypedDict(TypedDict): status: VerificationStatus strategy: Strategy - attempts: int - expire_at: int + attempts: Nullable[int] + expire_at: Nullable[int] + verified_at_client: NotRequired[Nullable[str]] class Otp(BaseModel): @@ -199,9 +206,41 @@ class Otp(BaseModel): strategy: Annotated[Strategy, PlainValidator(validate_open_enum(False))] - attempts: int + attempts: Nullable[int] + + expire_at: Nullable[int] + + verified_at_client: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["verified_at_client"] + nullable_fields = ["attempts", "expire_at", "verified_at_client"] + null_default_fields = [] + + serialized = handler(self) - expire_at: int + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m VerificationTypedDict = TypeAliasType( diff --git a/src/clerk_backend_api/models/getuserlistop.py b/src/clerk_backend_api/models/getuserlistop.py index 5f4111da..e647b497 100644 --- a/src/clerk_backend_api/models/getuserlistop.py +++ b/src/clerk_backend_api/models/getuserlistop.py @@ -75,6 +75,8 @@ class GetUserListRequestTypedDict(TypedDict): """ name_query: NotRequired[str] r"""Returns users with names that match the given query, via case-insensitive partial match.""" + banned: NotRequired[bool] + r"""Returns users which are either banned (`banned=true`) or not banned (`banned=false`).""" last_active_at_before: NotRequired[int] r"""Returns users whose last session activity was before the given date (with millisecond precision). Example: use 1700690400000 to retrieve users whose last session activity was before 2023-11-23. @@ -230,6 +232,12 @@ class GetUserListRequest(BaseModel): ] = None r"""Returns users with names that match the given query, via case-insensitive partial match.""" + banned: Annotated[ + Optional[bool], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Returns users which are either banned (`banned=true`) or not banned (`banned=false`).""" + last_active_at_before: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), diff --git a/src/clerk_backend_api/models/getuserscountop.py b/src/clerk_backend_api/models/getuserscountop.py index 43122c9f..cfb106a7 100644 --- a/src/clerk_backend_api/models/getuserscountop.py +++ b/src/clerk_backend_api/models/getuserscountop.py @@ -58,6 +58,8 @@ class GetUsersCountRequestTypedDict(TypedDict): For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`, and will be included in the resulting count. """ + banned: NotRequired[bool] + r"""Counts users which are either banned (`banned=true`) or not banned (`banned=false`).""" class GetUsersCountRequest(BaseModel): @@ -150,3 +152,9 @@ class GetUsersCountRequest(BaseModel): For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`, and will be included in the resulting count. """ + + banned: Annotated[ + Optional[bool], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Counts users which are either banned (`banned=true`) or not banned (`banned=false`).""" diff --git a/src/clerk_backend_api/models/listorganizationsop.py b/src/clerk_backend_api/models/listorganizationsop.py index dfc1304a..6ef6fed9 100644 --- a/src/clerk_backend_api/models/listorganizationsop.py +++ b/src/clerk_backend_api/models/listorganizationsop.py @@ -3,7 +3,7 @@ from __future__ import annotations from clerk_backend_api.types import BaseModel from clerk_backend_api.utils import FieldMetadata, QueryParamMetadata -from typing import Optional +from typing import List, Optional from typing_extensions import Annotated, NotRequired, TypedDict @@ -23,6 +23,16 @@ class ListOrganizationsRequestTypedDict(TypedDict): r"""Returns organizations with ID, name, or slug that match the given query. Uses exact match for organization ID and partial match for name and slug. """ + organization_id: NotRequired[List[str]] + r"""Returns organizations with the organization ids specified. + Any organization ids not found are ignored. + For each organization id, the `+` and `-` can be + prepended to the id, which denote whether the + respective organization should be included or + excluded from the result set. + Accepts up to 100 organization ids. + Example: ?organization_id=+org_1&organization_id=-org_2 + """ order_by: NotRequired[str] r"""Allows to return organizations in a particular order. At the moment, you can order the returned organizations either by their `name`, `created_at` or `members_count`. @@ -65,6 +75,20 @@ class ListOrganizationsRequest(BaseModel): Uses exact match for organization ID and partial match for name and slug. """ + organization_id: Annotated[ + Optional[List[str]], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Returns organizations with the organization ids specified. + Any organization ids not found are ignored. + For each organization id, the `+` and `-` can be + prepended to the id, which denote whether the + respective organization should be included or + excluded from the result set. + Accepts up to 100 organization ids. + Example: ?organization_id=+org_1&organization_id=-org_2 + """ + order_by: Annotated[ Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), diff --git a/src/clerk_backend_api/models/listwaitlistentriesop.py b/src/clerk_backend_api/models/listwaitlistentriesop.py index d909c808..5c88d455 100644 --- a/src/clerk_backend_api/models/listwaitlistentriesop.py +++ b/src/clerk_backend_api/models/listwaitlistentriesop.py @@ -28,7 +28,7 @@ class ListWaitlistEntriesRequestTypedDict(TypedDict): To be used in conjunction with `limit`. """ query: NotRequired[str] - r"""Filter waitlist entries by email address""" + r"""Filter waitlist entries by `email_address` or `id`""" status: NotRequired[ListWaitlistEntriesQueryParamStatus] r"""Filter waitlist entries by their status""" order_by: NotRequired[str] @@ -63,7 +63,7 @@ class ListWaitlistEntriesRequest(BaseModel): Optional[str], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None - r"""Filter waitlist entries by email address""" + r"""Filter waitlist entries by `email_address` or `id`""" status: Annotated[ Optional[ListWaitlistEntriesQueryParamStatus], diff --git a/src/clerk_backend_api/models/oauthapplication.py b/src/clerk_backend_api/models/oauthapplication.py index 23d9ecff..9e6efd32 100644 --- a/src/clerk_backend_api/models/oauthapplication.py +++ b/src/clerk_backend_api/models/oauthapplication.py @@ -3,7 +3,9 @@ from __future__ import annotations from clerk_backend_api.types import BaseModel from enum import Enum -from typing_extensions import TypedDict +import pydantic +from typing import List +from typing_extensions import Annotated, TypedDict class OAuthApplicationObject(str, Enum): @@ -18,6 +20,7 @@ class OAuthApplicationTypedDict(TypedDict): client_id: str public: bool scopes: str + redirect_uris: List[str] callback_url: str authorize_url: str token_fetch_url: str @@ -49,7 +52,14 @@ class OAuthApplication(BaseModel): scopes: str - callback_url: str + redirect_uris: List[str] + + callback_url: Annotated[ + str, + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] authorize_url: str diff --git a/src/clerk_backend_api/models/oauthapplicationwithsecret.py b/src/clerk_backend_api/models/oauthapplicationwithsecret.py index 07fa3981..a65fc0f6 100644 --- a/src/clerk_backend_api/models/oauthapplicationwithsecret.py +++ b/src/clerk_backend_api/models/oauthapplicationwithsecret.py @@ -3,8 +3,9 @@ from __future__ import annotations from clerk_backend_api.types import BaseModel from enum import Enum -from typing import Optional -from typing_extensions import NotRequired, TypedDict +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict class OAuthApplicationWithSecretObject(str, Enum): @@ -19,6 +20,7 @@ class OAuthApplicationWithSecretTypedDict(TypedDict): client_id: str public: bool scopes: str + redirect_uris: List[str] callback_url: str authorize_url: str token_fetch_url: str @@ -54,7 +56,14 @@ class OAuthApplicationWithSecret(BaseModel): scopes: str - callback_url: str + redirect_uris: List[str] + + callback_url: Annotated[ + str, + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] authorize_url: str diff --git a/src/clerk_backend_api/models/phonenumber.py b/src/clerk_backend_api/models/phonenumber.py index d1a7e72e..bfd2c4fe 100644 --- a/src/clerk_backend_api/models/phonenumber.py +++ b/src/clerk_backend_api/models/phonenumber.py @@ -35,8 +35,9 @@ class AdminVerificationStrategy(str, Enum, metaclass=utils.OpenEnumMeta): class VerificationAdminTypedDict(TypedDict): status: AdminVerificationPhoneNumberStatus strategy: AdminVerificationStrategy - attempts: NotRequired[Nullable[int]] - expire_at: NotRequired[Nullable[int]] + attempts: Nullable[int] + expire_at: Nullable[int] + verified_at_client: NotRequired[Nullable[str]] class VerificationAdmin(BaseModel): @@ -46,14 +47,16 @@ class VerificationAdmin(BaseModel): AdminVerificationStrategy, PlainValidator(validate_open_enum(False)) ] - attempts: OptionalNullable[int] = UNSET + attempts: Nullable[int] - expire_at: OptionalNullable[int] = UNSET + expire_at: Nullable[int] + + verified_at_client: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["attempts", "expire_at"] - nullable_fields = ["attempts", "expire_at"] + optional_fields = ["verified_at_client"] + nullable_fields = ["attempts", "expire_at", "verified_at_client"] null_default_fields = [] serialized = handler(self) @@ -103,8 +106,9 @@ class OTPVerificationStrategy(str, Enum, metaclass=utils.OpenEnumMeta): class VerificationOTPTypedDict(TypedDict): status: OTPVerificationStatus strategy: OTPVerificationStrategy - attempts: int - expire_at: int + attempts: Nullable[int] + expire_at: Nullable[int] + verified_at_client: NotRequired[Nullable[str]] class VerificationOTP(BaseModel): @@ -114,9 +118,41 @@ class VerificationOTP(BaseModel): OTPVerificationStrategy, PlainValidator(validate_open_enum(False)) ] - attempts: int + attempts: Nullable[int] + + expire_at: Nullable[int] + + verified_at_client: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["verified_at_client"] + nullable_fields = ["attempts", "expire_at", "verified_at_client"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member - expire_at: int + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m PhoneNumberVerificationTypedDict = TypeAliasType( diff --git a/src/clerk_backend_api/models/samlaccount.py b/src/clerk_backend_api/models/samlaccount.py index 73af844c..a4149061 100644 --- a/src/clerk_backend_api/models/samlaccount.py +++ b/src/clerk_backend_api/models/samlaccount.py @@ -34,8 +34,9 @@ class TicketVerificationStrategy(str, Enum): class TicketTypedDict(TypedDict): status: TicketVerificationStatus strategy: TicketVerificationStrategy - attempts: NotRequired[Nullable[int]] - expire_at: NotRequired[Nullable[int]] + attempts: Nullable[int] + expire_at: Nullable[int] + verified_at_client: NotRequired[Nullable[str]] class Ticket(BaseModel): @@ -43,14 +44,16 @@ class Ticket(BaseModel): strategy: TicketVerificationStrategy - attempts: OptionalNullable[int] = UNSET + attempts: Nullable[int] - expire_at: OptionalNullable[int] = UNSET + expire_at: Nullable[int] + + verified_at_client: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["attempts", "expire_at"] - nullable_fields = ["attempts", "expire_at"] + optional_fields = ["verified_at_client"] + nullable_fields = ["attempts", "expire_at", "verified_at_client"] null_default_fields = [] serialized = handler(self) @@ -129,8 +132,9 @@ class SamlTypedDict(TypedDict): strategy: SAMLVerificationStrategy external_verification_redirect_url: Nullable[str] expire_at: int + attempts: Nullable[int] error: NotRequired[Nullable[VerificationErrorTypedDict]] - attempts: NotRequired[Nullable[int]] + verified_at_client: NotRequired[Nullable[str]] class Saml(BaseModel): @@ -142,14 +146,21 @@ class Saml(BaseModel): expire_at: int + attempts: Nullable[int] + error: OptionalNullable[VerificationError] = UNSET - attempts: OptionalNullable[int] = UNSET + verified_at_client: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["error", "attempts"] - nullable_fields = ["external_verification_redirect_url", "error", "attempts"] + optional_fields = ["error", "verified_at_client"] + nullable_fields = [ + "external_verification_redirect_url", + "attempts", + "error", + "verified_at_client", + ] null_default_fields = [] serialized = handler(self) diff --git a/src/clerk_backend_api/models/schemas_passkey.py b/src/clerk_backend_api/models/schemas_passkey.py index 66e437ae..818de819 100644 --- a/src/clerk_backend_api/models/schemas_passkey.py +++ b/src/clerk_backend_api/models/schemas_passkey.py @@ -35,9 +35,11 @@ class Nonce(str, Enum): class PasskeyTypedDict(TypedDict): status: PasskeyVerificationStatus strategy: PasskeyVerificationStrategy + attempts: Nullable[int] + expire_at: Nullable[int] nonce: NotRequired[Nonce] - attempts: NotRequired[Nullable[int]] - expire_at: NotRequired[Nullable[int]] + message: NotRequired[Nullable[str]] + verified_at_client: NotRequired[Nullable[str]] class Passkey(BaseModel): @@ -45,16 +47,20 @@ class Passkey(BaseModel): strategy: PasskeyVerificationStrategy + attempts: Nullable[int] + + expire_at: Nullable[int] + nonce: Optional[Nonce] = None - attempts: OptionalNullable[int] = UNSET + message: OptionalNullable[str] = UNSET - expire_at: OptionalNullable[int] = UNSET + verified_at_client: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["nonce", "attempts", "expire_at"] - nullable_fields = ["attempts", "expire_at"] + optional_fields = ["nonce", "message", "verified_at_client"] + nullable_fields = ["attempts", "expire_at", "message", "verified_at_client"] null_default_fields = [] serialized = handler(self) diff --git a/src/clerk_backend_api/models/totp.py b/src/clerk_backend_api/models/totp.py deleted file mode 100644 index fb36381b..00000000 --- a/src/clerk_backend_api/models/totp.py +++ /dev/null @@ -1,87 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from clerk_backend_api.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import ConfigDict, model_serializer -from typing import Any, Dict, List -from typing_extensions import NotRequired, TypedDict - - -class TotpTypedDict(TypedDict): - r"""A TOTP (Time-based One-Time Password)""" - - object: str - id: str - secret: Nullable[str] - uri: Nullable[str] - verified: bool - backup_codes: NotRequired[Nullable[List[str]]] - - -class Totp(BaseModel): - r"""A TOTP (Time-based One-Time Password)""" - - model_config = ConfigDict( - populate_by_name=True, arbitrary_types_allowed=True, extra="allow" - ) - __pydantic_extra__: Dict[str, Any] = pydantic.Field(init=False) - - object: str - - id: str - - secret: Nullable[str] - - uri: Nullable[str] - - verified: bool - - backup_codes: OptionalNullable[List[str]] = UNSET - - @property - def additional_properties(self): - return self.__pydantic_extra__ - - @additional_properties.setter - def additional_properties(self, value): - self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["backup_codes"] - nullable_fields = ["secret", "uri", "backup_codes"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in self.model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - for k, v in serialized.items(): - m[k] = v - - return m diff --git a/src/clerk_backend_api/models/updateoauthapplicationop.py b/src/clerk_backend_api/models/updateoauthapplicationop.py index db548fc7..7cb386c7 100644 --- a/src/clerk_backend_api/models/updateoauthapplicationop.py +++ b/src/clerk_backend_api/models/updateoauthapplicationop.py @@ -1,31 +1,84 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from clerk_backend_api.types import BaseModel +from clerk_backend_api.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) from clerk_backend_api.utils import FieldMetadata, PathParamMetadata, RequestMetadata -from typing import Optional +import pydantic +from pydantic import model_serializer +from typing import List, Optional from typing_extensions import Annotated, NotRequired, TypedDict class UpdateOAuthApplicationRequestBodyTypedDict(TypedDict): - name: NotRequired[str] + name: NotRequired[Nullable[str]] r"""The new name of the OAuth application""" - callback_url: NotRequired[str] + redirect_uris: NotRequired[Nullable[List[str]]] + r"""An array of redirect URIs of the new OAuth application""" + callback_url: NotRequired[Nullable[str]] r"""The new callback URL of the OAuth application""" - scopes: NotRequired[str] + scopes: NotRequired[Nullable[str]] r"""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.""" + public: NotRequired[bool] + r"""If true, this client is public and you can use the Proof Key of Code Exchange (PKCE) flow.""" class UpdateOAuthApplicationRequestBody(BaseModel): - name: Optional[str] = None + name: OptionalNullable[str] = UNSET r"""The new name of the OAuth application""" - callback_url: Optional[str] = None + redirect_uris: OptionalNullable[List[str]] = UNSET + r"""An array of redirect URIs of the new OAuth application""" + + callback_url: Annotated[ + OptionalNullable[str], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = UNSET r"""The new callback URL of the OAuth application""" - scopes: Optional[str] = "profile email" + scopes: OptionalNullable[str] = "profile email" r"""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.""" + public: Optional[bool] = None + r"""If true, this client is public and you can use the Proof Key of Code Exchange (PKCE) flow.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["name", "redirect_uris", "callback_url", "scopes", "public"] + nullable_fields = ["name", "redirect_uris", "callback_url", "scopes"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + class UpdateOAuthApplicationRequestTypedDict(TypedDict): oauth_application_id: str diff --git a/src/clerk_backend_api/models/web3wallet.py b/src/clerk_backend_api/models/web3wallet.py index f9bdfc63..7a4c1072 100644 --- a/src/clerk_backend_api/models/web3wallet.py +++ b/src/clerk_backend_api/models/web3wallet.py @@ -34,8 +34,9 @@ class AdminVerificationWeb3WalletStrategy(str, Enum, metaclass=utils.OpenEnumMet class Web3WalletVerificationAdminTypedDict(TypedDict): status: AdminVerificationWeb3WalletStatus strategy: AdminVerificationWeb3WalletStrategy - attempts: NotRequired[Nullable[int]] - expire_at: NotRequired[Nullable[int]] + attempts: Nullable[int] + expire_at: Nullable[int] + verified_at_client: NotRequired[Nullable[str]] class Web3WalletVerificationAdmin(BaseModel): @@ -45,14 +46,16 @@ class Web3WalletVerificationAdmin(BaseModel): AdminVerificationWeb3WalletStrategy, PlainValidator(validate_open_enum(False)) ] - attempts: OptionalNullable[int] = UNSET + attempts: Nullable[int] - expire_at: OptionalNullable[int] = UNSET + expire_at: Nullable[int] + + verified_at_client: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["attempts", "expire_at"] - nullable_fields = ["attempts", "expire_at"] + optional_fields = ["verified_at_client"] + nullable_fields = ["attempts", "expire_at", "verified_at_client"] null_default_fields = [] serialized = handler(self) @@ -96,10 +99,11 @@ class Web3SignatureVerificationStrategy(str, Enum): class Web3SignatureTypedDict(TypedDict): status: Web3SignatureVerificationStatus strategy: Web3SignatureVerificationStrategy + attempts: Nullable[int] + expire_at: Nullable[int] nonce: NotRequired[Nullable[str]] message: NotRequired[Nullable[str]] - attempts: NotRequired[Nullable[int]] - expire_at: NotRequired[Nullable[int]] + verified_at_client: NotRequired[Nullable[str]] class Web3Signature(BaseModel): @@ -107,18 +111,26 @@ class Web3Signature(BaseModel): strategy: Web3SignatureVerificationStrategy + attempts: Nullable[int] + + expire_at: Nullable[int] + nonce: OptionalNullable[str] = UNSET message: OptionalNullable[str] = UNSET - attempts: OptionalNullable[int] = UNSET - - expire_at: OptionalNullable[int] = UNSET + verified_at_client: OptionalNullable[str] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["nonce", "message", "attempts", "expire_at"] - nullable_fields = ["nonce", "message", "attempts", "expire_at"] + optional_fields = ["nonce", "message", "verified_at_client"] + nullable_fields = [ + "attempts", + "expire_at", + "nonce", + "message", + "verified_at_client", + ] null_default_fields = [] serialized = handler(self) diff --git a/src/clerk_backend_api/oauthapplications_sdk.py b/src/clerk_backend_api/oauthapplications_sdk.py index 25b9f3b4..b5790fb4 100644 --- a/src/clerk_backend_api/oauthapplications_sdk.py +++ b/src/clerk_backend_api/oauthapplications_sdk.py @@ -4,7 +4,7 @@ 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, Mapping, Optional, Union, cast +from typing import Any, List, Mapping, Optional, Union, cast class OauthApplicationsSDK(BaseSDK): @@ -39,6 +39,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOAuthApplicationsRequest( limit=limit, @@ -64,13 +66,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOAuthApplications", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -80,14 +87,14 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplications] ) if utils.match_response(http_res, ["400", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -139,6 +146,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOAuthApplicationsRequest( limit=limit, @@ -164,13 +173,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOAuthApplications", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -180,14 +194,14 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplications] ) if utils.match_response(http_res, ["400", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -241,6 +255,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -274,13 +290,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOAuthApplication", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -290,14 +311,14 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplicationWithSecret] ) if utils.match_response(http_res, ["400", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -351,6 +372,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -384,13 +407,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOAuthApplication", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -400,14 +428,14 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplicationWithSecret] ) if utils.match_response(http_res, ["400", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -454,6 +482,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOAuthApplicationRequest( oauth_application_id=oauth_application_id, @@ -478,13 +508,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetOAuthApplication", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -494,14 +529,14 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplication] ) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -548,6 +583,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOAuthApplicationRequest( oauth_application_id=oauth_application_id, @@ -572,13 +609,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetOAuthApplication", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -588,14 +630,14 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplication] ) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -620,9 +662,11 @@ def update( self, *, oauth_application_id: str, - name: Optional[str] = None, - callback_url: Optional[str] = None, - scopes: Optional[str] = "profile email", + name: OptionalNullable[str] = UNSET, + redirect_uris: OptionalNullable[List[str]] = UNSET, + callback_url: OptionalNullable[str] = UNSET, + scopes: OptionalNullable[str] = "profile email", + public: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -634,8 +678,10 @@ def update( :param oauth_application_id: The ID of the OAuth application to update :param name: The new name of the OAuth application + :param redirect_uris: An array of redirect URIs of the new OAuth application :param callback_url: The new callback URL of the 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 you can use the Proof Key of Code Exchange (PKCE) flow. :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 @@ -648,13 +694,17 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOAuthApplicationRequest( oauth_application_id=oauth_application_id, request_body=models.UpdateOAuthApplicationRequestBody( name=name, + redirect_uris=redirect_uris, callback_url=callback_url, scopes=scopes, + public=public, ), ) @@ -684,30 +734,37 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOAuthApplication", oauth2_scopes=[], security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["403", "404", "422", "4XX", "5XX"], + error_status_codes=["400", "403", "404", "422", "4XX", "5XX"], retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplication] ) - if utils.match_response(http_res, ["403", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + if utils.match_response( + http_res, ["400", "403", "404", "422"], "application/json" + ): + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -732,9 +789,11 @@ async def update_async( self, *, oauth_application_id: str, - name: Optional[str] = None, - callback_url: Optional[str] = None, - scopes: Optional[str] = "profile email", + name: OptionalNullable[str] = UNSET, + redirect_uris: OptionalNullable[List[str]] = UNSET, + callback_url: OptionalNullable[str] = UNSET, + scopes: OptionalNullable[str] = "profile email", + public: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -746,8 +805,10 @@ async def update_async( :param oauth_application_id: The ID of the OAuth application to update :param name: The new name of the OAuth application + :param redirect_uris: An array of redirect URIs of the new OAuth application :param callback_url: The new callback URL of the 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 you can use the Proof Key of Code Exchange (PKCE) flow. :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 @@ -760,13 +821,17 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOAuthApplicationRequest( oauth_application_id=oauth_application_id, request_body=models.UpdateOAuthApplicationRequestBody( name=name, + redirect_uris=redirect_uris, callback_url=callback_url, scopes=scopes, + public=public, ), ) @@ -796,30 +861,37 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOAuthApplication", oauth2_scopes=[], security_source=self.sdk_configuration.security, ), request=req, - error_status_codes=["403", "404", "422", "4XX", "5XX"], + error_status_codes=["400", "403", "404", "422", "4XX", "5XX"], retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplication] ) - if utils.match_response(http_res, ["403", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + if utils.match_response( + http_res, ["400", "403", "404", "422"], "application/json" + ): + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -867,6 +939,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOAuthApplicationRequest( oauth_application_id=oauth_application_id, @@ -891,13 +965,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOAuthApplication", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -907,12 +986,12 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -960,6 +1039,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOAuthApplicationRequest( oauth_application_id=oauth_application_id, @@ -984,13 +1065,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOAuthApplication", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1000,12 +1086,12 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1053,6 +1139,8 @@ def rotate_secret( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RotateOAuthApplicationSecretRequest( oauth_application_id=oauth_application_id, @@ -1077,13 +1165,18 @@ def rotate_secret( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RotateOAuthApplicationSecret", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1093,14 +1186,14 @@ def rotate_secret( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplicationWithSecret] ) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1148,6 +1241,8 @@ async def rotate_secret_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RotateOAuthApplicationSecretRequest( oauth_application_id=oauth_application_id, @@ -1172,13 +1267,18 @@ async def rotate_secret_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RotateOAuthApplicationSecret", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1188,14 +1288,14 @@ async def rotate_secret_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OAuthApplicationWithSecret] ) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/organizationdomain_sdk.py b/src/clerk_backend_api/organizationdomain_sdk.py index 1fd45fd1..55f19f85 100644 --- a/src/clerk_backend_api/organizationdomain_sdk.py +++ b/src/clerk_backend_api/organizationdomain_sdk.py @@ -40,6 +40,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOrganizationDomainRequest( organization_id=organization_id, @@ -76,13 +78,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOrganizationDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -92,14 +99,14 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationDomain] ) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -152,6 +159,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOrganizationDomainRequest( organization_id=organization_id, @@ -188,13 +197,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOrganizationDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -204,14 +218,14 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationDomain] ) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/organizationdomains_sdk.py b/src/clerk_backend_api/organizationdomains_sdk.py index b2af66fa..c38f9afe 100644 --- a/src/clerk_backend_api/organizationdomains_sdk.py +++ b/src/clerk_backend_api/organizationdomains_sdk.py @@ -40,6 +40,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateOrganizationDomainRequest( organization_id=organization_id, @@ -76,13 +78,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganizationDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -92,7 +99,7 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationDomain] @@ -100,8 +107,8 @@ def create( if utils.match_response( http_res, ["400", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -154,6 +161,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateOrganizationDomainRequest( organization_id=organization_id, @@ -190,13 +199,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganizationDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -206,7 +220,7 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationDomain] @@ -214,8 +228,8 @@ async def create_async( if utils.match_response( http_res, ["400", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -270,6 +284,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOrganizationDomainsRequest( organization_id=organization_id, @@ -298,13 +314,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOrganizationDomains", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -314,14 +335,14 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationDomains] ) if utils.match_response(http_res, ["401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -376,6 +397,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOrganizationDomainsRequest( organization_id=organization_id, @@ -404,13 +427,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOrganizationDomains", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -420,14 +448,14 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationDomains] ) if utils.match_response(http_res, ["401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -476,6 +504,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOrganizationDomainRequest( organization_id=organization_id, @@ -501,13 +531,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOrganizationDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -517,12 +552,12 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -571,6 +606,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOrganizationDomainRequest( organization_id=organization_id, @@ -596,13 +633,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOrganizationDomain", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -612,12 +654,12 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/organizationinvitations_sdk.py b/src/clerk_backend_api/organizationinvitations_sdk.py index 90c30340..c384c33a 100644 --- a/src/clerk_backend_api/organizationinvitations_sdk.py +++ b/src/clerk_backend_api/organizationinvitations_sdk.py @@ -50,6 +50,8 @@ def get_all( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListInstanceOrganizationInvitationsRequest( limit=limit, @@ -78,13 +80,18 @@ def get_all( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListInstanceOrganizationInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -94,18 +101,18 @@ def get_all( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitationsWithPublicOrganizationData], ) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -167,6 +174,8 @@ async def get_all_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListInstanceOrganizationInvitationsRequest( limit=limit, @@ -195,13 +204,18 @@ async def get_all_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListInstanceOrganizationInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -211,18 +225,18 @@ async def get_all_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitationsWithPublicOrganizationData], ) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -298,6 +312,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateOrganizationInvitationRequest( organization_id=organization_id, @@ -338,13 +354,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganizationInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -354,7 +375,7 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitation] @@ -362,8 +383,8 @@ def create( if utils.match_response( http_res, ["400", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -439,6 +460,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateOrganizationInvitationRequest( organization_id=organization_id, @@ -479,13 +502,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganizationInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -495,7 +523,7 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitation] @@ -503,8 +531,8 @@ async def create_async( if utils.match_response( http_res, ["400", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -562,6 +590,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOrganizationInvitationsRequest( organization_id=organization_id, @@ -589,13 +619,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOrganizationInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -605,14 +640,14 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitations] ) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -670,6 +705,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOrganizationInvitationsRequest( organization_id=organization_id, @@ -697,13 +734,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOrganizationInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -713,14 +755,14 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitations] ) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -784,6 +826,8 @@ def bulk_create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateOrganizationInvitationBulkRequest( organization_id=organization_id, @@ -818,13 +862,18 @@ def bulk_create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganizationInvitationBulk", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -834,7 +883,7 @@ def bulk_create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitations] @@ -842,8 +891,8 @@ def bulk_create( if utils.match_response( http_res, ["400", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -907,6 +956,8 @@ async def bulk_create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateOrganizationInvitationBulkRequest( organization_id=organization_id, @@ -941,13 +992,18 @@ async def bulk_create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganizationInvitationBulk", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -957,7 +1013,7 @@ async def bulk_create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitations] @@ -965,8 +1021,8 @@ async def bulk_create_async( if utils.match_response( http_res, ["400", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1025,6 +1081,8 @@ def list_pending( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListPendingOrganizationInvitationsRequest( organization_id=organization_id, @@ -1051,13 +1109,18 @@ def list_pending( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListPendingOrganizationInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1067,14 +1130,14 @@ def list_pending( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitations] ) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1133,6 +1196,8 @@ async def list_pending_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListPendingOrganizationInvitationsRequest( organization_id=organization_id, @@ -1159,13 +1224,18 @@ async def list_pending_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListPendingOrganizationInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1175,14 +1245,14 @@ async def list_pending_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitations] ) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1231,6 +1301,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOrganizationInvitationRequest( organization_id=organization_id, @@ -1256,13 +1328,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetOrganizationInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1272,14 +1349,14 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitation] ) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1328,6 +1405,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOrganizationInvitationRequest( organization_id=organization_id, @@ -1353,13 +1432,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetOrganizationInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1369,14 +1453,14 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitation] ) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1431,6 +1515,8 @@ def revoke( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeOrganizationInvitationRequest( organization_id=organization_id, @@ -1466,13 +1552,18 @@ def revoke( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeOrganizationInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1482,14 +1573,14 @@ def revoke( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitation] ) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1544,6 +1635,8 @@ async def revoke_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeOrganizationInvitationRequest( organization_id=organization_id, @@ -1579,13 +1672,18 @@ async def revoke_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeOrganizationInvitation", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1595,14 +1693,14 @@ async def revoke_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitation] ) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/organizationmemberships_sdk.py b/src/clerk_backend_api/organizationmemberships_sdk.py index 97f1e9f6..3dd2a355 100644 --- a/src/clerk_backend_api/organizationmemberships_sdk.py +++ b/src/clerk_backend_api/organizationmemberships_sdk.py @@ -38,6 +38,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateOrganizationMembershipRequest( organization_id=organization_id, @@ -73,13 +75,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganizationMembership", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -89,7 +96,7 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMembership] @@ -97,8 +104,8 @@ def create( if utils.match_response( http_res, ["400", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -149,6 +156,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateOrganizationMembershipRequest( organization_id=organization_id, @@ -184,13 +193,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganizationMembership", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -200,7 +214,7 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMembership] @@ -208,8 +222,8 @@ async def create_async( if utils.match_response( http_res, ["400", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -262,6 +276,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOrganizationMembershipsRequest( organization_id=organization_id, @@ -289,13 +305,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOrganizationMemberships", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -305,14 +326,14 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMemberships] ) if utils.match_response(http_res, ["401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -365,6 +386,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOrganizationMembershipsRequest( organization_id=organization_id, @@ -392,13 +415,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOrganizationMemberships", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -408,14 +436,14 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMemberships] ) if utils.match_response(http_res, ["401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -466,6 +494,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOrganizationMembershipRequest( organization_id=organization_id, @@ -501,13 +531,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOrganizationMembership", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -517,14 +552,14 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMembership] ) if utils.match_response(http_res, ["404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -575,6 +610,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOrganizationMembershipRequest( organization_id=organization_id, @@ -610,13 +647,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOrganizationMembership", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -626,14 +668,14 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMembership] ) if utils.match_response(http_res, ["404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -682,6 +724,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOrganizationMembershipRequest( organization_id=organization_id, @@ -707,13 +751,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOrganizationMembership", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -723,14 +772,14 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMembership] ) if utils.match_response(http_res, ["401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -779,6 +828,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOrganizationMembershipRequest( organization_id=organization_id, @@ -804,13 +855,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOrganizationMembership", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -820,14 +876,14 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMembership] ) if utils.match_response(http_res, ["401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -882,6 +938,8 @@ def update_metadata( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOrganizationMembershipMetadataRequest( organization_id=organization_id, @@ -918,13 +976,18 @@ def update_metadata( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOrganizationMembershipMetadata", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -934,14 +997,14 @@ def update_metadata( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMembership] ) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -996,6 +1059,8 @@ async def update_metadata_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOrganizationMembershipMetadataRequest( organization_id=organization_id, @@ -1032,13 +1097,18 @@ async def update_metadata_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOrganizationMembershipMetadata", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1048,14 +1118,14 @@ async def update_metadata_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMembership] ) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1106,6 +1176,8 @@ def get_all( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.InstanceGetOrganizationMembershipsRequest( limit=limit, @@ -1132,13 +1204,18 @@ def get_all( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="InstanceGetOrganizationMemberships", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1148,17 +1225,17 @@ def get_all( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMemberships] ) if utils.match_response(http_res, ["400", "401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1209,6 +1286,8 @@ async def get_all_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.InstanceGetOrganizationMembershipsRequest( limit=limit, @@ -1235,13 +1314,18 @@ async def get_all_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="InstanceGetOrganizationMemberships", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1251,17 +1335,17 @@ async def get_all_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMemberships] ) if utils.match_response(http_res, ["400", "401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/organizations_sdk.py b/src/clerk_backend_api/organizations_sdk.py index 6a8f7d70..db2d1c62 100644 --- a/src/clerk_backend_api/organizations_sdk.py +++ b/src/clerk_backend_api/organizations_sdk.py @@ -4,7 +4,7 @@ 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, Mapping, Optional, Union, cast +from typing import Any, Dict, List, Mapping, Optional, Union, cast class OrganizationsSDK(BaseSDK): @@ -19,6 +19,7 @@ def list( offset: Optional[int] = 0, include_members_count: Optional[bool] = None, query: Optional[str] = None, + organization_id: Optional[List[str]] = None, order_by: Optional[str] = "-created_at", retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -36,6 +37,7 @@ def list( :param offset: Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`. :param include_members_count: Flag to denote whether the member counts of each organization should be included in the response or not. :param query: Returns organizations with ID, name, or slug that match the given query. Uses exact match for organization ID and partial match for name and slug. + :param organization_id: Returns organizations with the organization ids specified. Any organization ids not found are ignored. For each organization id, the `+` and `-` can be prepended to the id, which denote whether the respective organization should be included or excluded from the result set. Accepts up to 100 organization ids. Example: ?organization_id=+org_1&organization_id=-org_2 :param order_by: Allows to return organizations in a particular order. At the moment, you can order the returned organizations either by their `name`, `created_at` or `members_count`. In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by. For example, if you want organizations to be returned in descending order according to their `created_at` property, you can use `-created_at`. If you don't use `+` or `-`, then `+` is implied. Defaults to `-created_at`. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -49,12 +51,15 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOrganizationsRequest( limit=limit, offset=offset, include_members_count=include_members_count, query=query, + organization_id=organization_id, order_by=order_by, ) @@ -77,13 +82,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOrganizations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -93,12 +103,12 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organizations]) if utils.match_response(http_res, ["400", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -126,6 +136,7 @@ async def list_async( offset: Optional[int] = 0, include_members_count: Optional[bool] = None, query: Optional[str] = None, + organization_id: Optional[List[str]] = None, order_by: Optional[str] = "-created_at", retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -143,6 +154,7 @@ async def list_async( :param offset: Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`. :param include_members_count: Flag to denote whether the member counts of each organization should be included in the response or not. :param query: Returns organizations with ID, name, or slug that match the given query. Uses exact match for organization ID and partial match for name and slug. + :param organization_id: Returns organizations with the organization ids specified. Any organization ids not found are ignored. For each organization id, the `+` and `-` can be prepended to the id, which denote whether the respective organization should be included or excluded from the result set. Accepts up to 100 organization ids. Example: ?organization_id=+org_1&organization_id=-org_2 :param order_by: Allows to return organizations in a particular order. At the moment, you can order the returned organizations either by their `name`, `created_at` or `members_count`. In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by. For example, if you want organizations to be returned in descending order according to their `created_at` property, you can use `-created_at`. If you don't use `+` or `-`, then `+` is implied. Defaults to `-created_at`. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -156,12 +168,15 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOrganizationsRequest( limit=limit, offset=offset, include_members_count=include_members_count, query=query, + organization_id=organization_id, order_by=order_by, ) @@ -184,13 +199,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListOrganizations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -200,12 +220,12 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organizations]) if utils.match_response(http_res, ["400", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -266,6 +286,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -299,13 +321,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganization", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -315,12 +342,12 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response(http_res, ["400", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -381,6 +408,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -414,13 +443,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateOrganization", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -430,12 +464,12 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response(http_res, ["400", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -484,6 +518,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOrganizationRequest( organization_id=organization_id, @@ -509,13 +545,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetOrganization", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -525,12 +566,12 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -579,6 +620,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOrganizationRequest( organization_id=organization_id, @@ -604,13 +647,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetOrganization", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -620,12 +668,12 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -688,6 +736,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOrganizationRequest( organization_id=organization_id, @@ -729,13 +779,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOrganization", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -745,12 +800,12 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response(http_res, ["402", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -813,6 +868,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateOrganizationRequest( organization_id=organization_id, @@ -854,13 +911,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateOrganization", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -870,12 +932,12 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response(http_res, ["402", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -924,6 +986,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOrganizationRequest( organization_id=organization_id, @@ -948,13 +1012,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOrganization", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -964,12 +1033,12 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1018,6 +1087,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOrganizationRequest( organization_id=organization_id, @@ -1042,13 +1113,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOrganization", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1058,12 +1134,12 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1119,6 +1195,8 @@ def merge_metadata( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.MergeOrganizationMetadataRequest( organization_id=organization_id, @@ -1155,13 +1233,18 @@ def merge_metadata( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="MergeOrganizationMetadata", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1171,14 +1254,14 @@ def merge_metadata( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1234,6 +1317,8 @@ async def merge_metadata_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.MergeOrganizationMetadataRequest( organization_id=organization_id, @@ -1270,13 +1355,18 @@ async def merge_metadata_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="MergeOrganizationMetadata", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1286,14 +1376,14 @@ async def merge_metadata_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1350,6 +1440,8 @@ def upload_logo( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UploadOrganizationLogoRequest( organization_id=organization_id, @@ -1385,13 +1477,18 @@ def upload_logo( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UploadOrganizationLogo", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1401,7 +1498,7 @@ def upload_logo( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationWithLogo] @@ -1409,8 +1506,8 @@ def upload_logo( if utils.match_response( http_res, ["400", "403", "404", "413"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1467,6 +1564,8 @@ async def upload_logo_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UploadOrganizationLogoRequest( organization_id=organization_id, @@ -1502,13 +1601,18 @@ async def upload_logo_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UploadOrganizationLogo", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1518,7 +1622,7 @@ async def upload_logo_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationWithLogo] @@ -1526,8 +1630,8 @@ async def upload_logo_async( if utils.match_response( http_res, ["400", "403", "404", "413"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1572,6 +1676,8 @@ def delete_logo( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOrganizationLogoRequest( organization_id=organization_id, @@ -1596,13 +1702,18 @@ def delete_logo( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOrganizationLogo", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1612,12 +1723,12 @@ def delete_logo( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1662,6 +1773,8 @@ async def delete_logo_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteOrganizationLogoRequest( organization_id=organization_id, @@ -1686,13 +1799,18 @@ async def delete_logo_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteOrganizationLogo", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1702,12 +1820,12 @@ async def delete_logo_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Organization]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/phonenumbers.py b/src/clerk_backend_api/phonenumbers.py index 3127910f..80785fd0 100644 --- a/src/clerk_backend_api/phonenumbers.py +++ b/src/clerk_backend_api/phonenumbers.py @@ -39,6 +39,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -72,13 +74,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreatePhoneNumber", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -88,14 +95,14 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.PhoneNumber]) if utils.match_response( http_res, ["400", "401", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -147,6 +154,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -180,13 +189,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreatePhoneNumber", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -196,14 +210,14 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.PhoneNumber]) if utils.match_response( http_res, ["400", "401", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -250,6 +264,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetPhoneNumberRequest( phone_number_id=phone_number_id, @@ -274,13 +290,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetPhoneNumber", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -290,14 +311,14 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.PhoneNumber]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -344,6 +365,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetPhoneNumberRequest( phone_number_id=phone_number_id, @@ -368,13 +391,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetPhoneNumber", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -384,14 +412,14 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.PhoneNumber]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -438,6 +466,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeletePhoneNumberRequest( phone_number_id=phone_number_id, @@ -462,13 +492,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeletePhoneNumber", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -478,14 +513,14 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -532,6 +567,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeletePhoneNumberRequest( phone_number_id=phone_number_id, @@ -556,13 +593,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeletePhoneNumber", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -572,14 +614,14 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -632,6 +674,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdatePhoneNumberRequest( phone_number_id=phone_number_id, @@ -668,13 +712,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdatePhoneNumber", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -684,14 +733,14 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.PhoneNumber]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -744,6 +793,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdatePhoneNumberRequest( phone_number_id=phone_number_id, @@ -780,13 +831,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdatePhoneNumber", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -796,14 +852,14 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.PhoneNumber]) if utils.match_response( http_res, ["400", "401", "403", "404"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/proxychecks.py b/src/clerk_backend_api/proxychecks.py index 8e7c457f..6dcb7ae3 100644 --- a/src/clerk_backend_api/proxychecks.py +++ b/src/clerk_backend_api/proxychecks.py @@ -46,6 +46,8 @@ def verify( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -79,13 +81,18 @@ def verify( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifyDomainProxy", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -95,12 +102,12 @@ def verify( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.ProxyCheck]) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -159,6 +166,8 @@ async def verify_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -192,13 +201,18 @@ async def verify_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifyDomainProxy", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -208,12 +222,12 @@ async def verify_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.ProxyCheck]) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/redirecturls.py b/src/clerk_backend_api/redirecturls.py index 0a0ea05c..10d70b16 100644 --- a/src/clerk_backend_api/redirecturls.py +++ b/src/clerk_backend_api/redirecturls.py @@ -32,6 +32,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="GET", path="/redirect_urls", @@ -51,13 +53,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListRedirectURLs", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -115,6 +122,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="GET", path="/redirect_urls", @@ -134,13 +143,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListRedirectURLs", oauth2_scopes=[], security_source=self.sdk_configuration.security, diff --git a/src/clerk_backend_api/samlconnections_sdk.py b/src/clerk_backend_api/samlconnections_sdk.py index 8e1ace70..2ffbd231 100644 --- a/src/clerk_backend_api/samlconnections_sdk.py +++ b/src/clerk_backend_api/samlconnections_sdk.py @@ -40,6 +40,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListSAMLConnectionsRequest( limit=limit, @@ -66,13 +68,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListSAMLConnections", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -82,12 +89,12 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SAMLConnections]) if utils.match_response(http_res, ["402", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -140,6 +147,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListSAMLConnectionsRequest( limit=limit, @@ -166,13 +175,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListSAMLConnections", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -182,12 +196,12 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SAMLConnections]) if utils.match_response(http_res, ["402", "403", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -239,6 +253,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -272,13 +288,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSAMLConnection", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -288,7 +309,7 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.SchemasSAMLConnection] @@ -296,8 +317,8 @@ def create( if utils.match_response( http_res, ["402", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -349,6 +370,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -382,13 +405,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSAMLConnection", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -398,7 +426,7 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.SchemasSAMLConnection] @@ -406,8 +434,8 @@ async def create_async( if utils.match_response( http_res, ["402", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -454,6 +482,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetSAMLConnectionRequest( saml_connection_id=saml_connection_id, @@ -478,13 +508,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetSAMLConnection", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -494,14 +529,14 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.SchemasSAMLConnection] ) if utils.match_response(http_res, ["402", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -548,6 +583,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetSAMLConnectionRequest( saml_connection_id=saml_connection_id, @@ -572,13 +609,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetSAMLConnection", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -588,14 +630,14 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.SchemasSAMLConnection] ) if utils.match_response(http_res, ["402", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -675,6 +717,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateSAMLConnectionRequest( saml_connection_id=saml_connection_id, @@ -725,13 +769,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateSAMLConnection", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -741,7 +790,7 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.SchemasSAMLConnection] @@ -749,8 +798,8 @@ def update( if utils.match_response( http_res, ["402", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -830,6 +879,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateSAMLConnectionRequest( saml_connection_id=saml_connection_id, @@ -880,13 +931,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateSAMLConnection", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -896,7 +952,7 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.SchemasSAMLConnection] @@ -904,8 +960,8 @@ async def update_async( if utils.match_response( http_res, ["402", "403", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -952,6 +1008,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteSAMLConnectionRequest( saml_connection_id=saml_connection_id, @@ -976,13 +1034,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteSAMLConnection", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -992,12 +1055,12 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["402", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1044,6 +1107,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteSAMLConnectionRequest( saml_connection_id=saml_connection_id, @@ -1068,13 +1133,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteSAMLConnection", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1084,12 +1154,12 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["402", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/sdk.py b/src/clerk_backend_api/sdk.py index 0dd9fa3a..89580b5e 100644 --- a/src/clerk_backend_api/sdk.py +++ b/src/clerk_backend_api/sdk.py @@ -264,7 +264,9 @@ async def __aexit__(self, exc_type, exc_val, exc_tb): await self.sdk_configuration.async_client.aclose() # region sdk-class-body - def authenticate_request(self, request: httpx.Request, options: AuthenticateRequestOptions) -> RequestState: + def authenticate_request( + self, request: httpx.Request, options: AuthenticateRequestOptions + ) -> RequestState: """ Authenticates the session token. Networkless if the options.jwt_key is provided. Otherwise, performs a network call to retrieve the JWKS from Clerk's Backend API. @@ -283,4 +285,5 @@ def authenticate_request(self, request: httpx.Request, options: AuthenticateRequ options.secret_key = security.bearer_auth return authenticate_request(request, options) + # endregion sdk-class-body diff --git a/src/clerk_backend_api/sessions.py b/src/clerk_backend_api/sessions.py index 23938df0..15b85102 100644 --- a/src/clerk_backend_api/sessions.py +++ b/src/clerk_backend_api/sessions.py @@ -52,6 +52,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetSessionListRequest( client_id=client_id, @@ -80,13 +82,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetSessionList", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -96,12 +103,12 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[List[models.Session]]) if utils.match_response(http_res, ["400", "401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -159,6 +166,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetSessionListRequest( client_id=client_id, @@ -187,13 +196,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetSessionList", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -203,12 +217,12 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[List[models.Session]]) if utils.match_response(http_res, ["400", "401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -247,7 +261,8 @@ def create_session( Create a new active session for the provided user ID. - This operation is only available for Clerk Development instances. + **This operation is intended only for use in testing, and is not available for production instances.** If you are looking to generate a user session from the backend, + we recommend using the [Sign-in Tokens](https://clerk.com/docs/reference/backend-api/tag/Sign-in-Tokens#operation/CreateSignInToken) resource instead. :param request: The request object to send. :param retries: Override the default retry configuration for this method @@ -262,6 +277,8 @@ def create_session( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -291,13 +308,18 @@ def create_session( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createSession", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -307,14 +329,14 @@ def create_session( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Session]) if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -353,7 +375,8 @@ async def create_session_async( Create a new active session for the provided user ID. - This operation is only available for Clerk Development instances. + **This operation is intended only for use in testing, and is not available for production instances.** If you are looking to generate a user session from the backend, + we recommend using the [Sign-in Tokens](https://clerk.com/docs/reference/backend-api/tag/Sign-in-Tokens#operation/CreateSignInToken) resource instead. :param request: The request object to send. :param retries: Override the default retry configuration for this method @@ -368,6 +391,8 @@ async def create_session_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -397,13 +422,18 @@ async def create_session_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createSession", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -413,14 +443,14 @@ async def create_session_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Session]) if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -467,6 +497,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetSessionRequest( session_id=session_id, @@ -491,13 +523,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetSession", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -507,12 +544,12 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Session]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -559,6 +596,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetSessionRequest( session_id=session_id, @@ -583,13 +622,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetSession", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -599,12 +643,12 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Session]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -652,6 +696,8 @@ def revoke( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeSessionRequest( session_id=session_id, @@ -676,13 +722,18 @@ def revoke( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeSession", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -692,12 +743,12 @@ def revoke( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Session]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -745,6 +796,8 @@ async def revoke_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeSessionRequest( session_id=session_id, @@ -769,13 +822,18 @@ async def revoke_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeSession", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -785,12 +843,12 @@ async def revoke_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Session]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -845,6 +903,8 @@ def verify( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.VerifySessionRequest( session_id=session_id, @@ -879,13 +939,18 @@ def verify( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifySession", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -895,14 +960,14 @@ def verify( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Session]) if utils.match_response( http_res, ["400", "401", "404", "410"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -957,6 +1022,8 @@ async def verify_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.VerifySessionRequest( session_id=session_id, @@ -991,13 +1058,18 @@ async def verify_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifySession", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1007,14 +1079,14 @@ async def verify_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.Session]) if utils.match_response( http_res, ["400", "401", "404", "410"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1063,6 +1135,8 @@ def create_session_token( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateSessionTokenRequest( session_id=session_id, @@ -1097,13 +1171,18 @@ def create_session_token( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSessionToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1113,14 +1192,14 @@ def create_session_token( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.CreateSessionTokenResponseBody] ) if utils.match_response(http_res, ["401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1169,6 +1248,8 @@ async def create_session_token_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateSessionTokenRequest( session_id=session_id, @@ -1203,13 +1284,18 @@ async def create_session_token_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSessionToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1219,14 +1305,14 @@ async def create_session_token_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.CreateSessionTokenResponseBody] ) if utils.match_response(http_res, ["401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1277,6 +1363,8 @@ def create_token_from_template( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateSessionTokenFromTemplateRequest( session_id=session_id, @@ -1312,13 +1400,18 @@ def create_token_from_template( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSessionTokenFromTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1328,15 +1421,15 @@ def create_token_from_template( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.CreateSessionTokenFromTemplateResponseBody], ) if utils.match_response(http_res, ["401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1387,6 +1480,8 @@ async def create_token_from_template_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.CreateSessionTokenFromTemplateRequest( session_id=session_id, @@ -1422,13 +1517,18 @@ async def create_token_from_template_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSessionTokenFromTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1438,15 +1538,15 @@ async def create_token_from_template_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.CreateSessionTokenFromTemplateResponseBody], ) if utils.match_response(http_res, ["401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/signintokens.py b/src/clerk_backend_api/signintokens.py index b5ea80ca..c752de32 100644 --- a/src/clerk_backend_api/signintokens.py +++ b/src/clerk_backend_api/signintokens.py @@ -41,6 +41,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -74,13 +76,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSignInToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -90,12 +97,12 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SignInToken]) if utils.match_response(http_res, ["404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -149,6 +156,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -182,13 +191,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSignInToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -198,12 +212,12 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SignInToken]) if utils.match_response(http_res, ["404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -250,6 +264,8 @@ def revoke( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeSignInTokenRequest( sign_in_token_id=sign_in_token_id, @@ -274,13 +290,18 @@ def revoke( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeSignInToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -290,12 +311,12 @@ def revoke( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SignInToken]) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -342,6 +363,8 @@ async def revoke_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.RevokeSignInTokenRequest( sign_in_token_id=sign_in_token_id, @@ -366,13 +389,18 @@ async def revoke_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="RevokeSignInToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -382,12 +410,12 @@ async def revoke_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SignInToken]) if utils.match_response(http_res, ["400", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/signups.py b/src/clerk_backend_api/signups.py index ddd89635..149018b7 100644 --- a/src/clerk_backend_api/signups.py +++ b/src/clerk_backend_api/signups.py @@ -36,6 +36,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateSignUpRequest( id=id, @@ -70,13 +72,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateSignUp", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -86,12 +93,12 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SignUp]) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -140,6 +147,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateSignUpRequest( id=id, @@ -174,13 +183,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateSignUp", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -190,12 +204,12 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SignUp]) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/templates.py b/src/clerk_backend_api/templates.py index a72987a0..fc2fce59 100644 --- a/src/clerk_backend_api/templates.py +++ b/src/clerk_backend_api/templates.py @@ -48,6 +48,8 @@ def preview( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.PreviewTemplateRequest( template_type=template_type, @@ -86,13 +88,18 @@ def preview( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="PreviewTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -102,7 +109,7 @@ def preview( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.PreviewTemplateResponseBody] @@ -110,8 +117,8 @@ def preview( if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -171,6 +178,8 @@ async def preview_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.PreviewTemplateRequest( template_type=template_type, @@ -209,13 +218,18 @@ async def preview_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="PreviewTemplate", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -225,7 +239,7 @@ async def preview_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.PreviewTemplateResponseBody] @@ -233,8 +247,8 @@ async def preview_async( if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/testingtokens.py b/src/clerk_backend_api/testingtokens.py index 49e61b71..4ba1fb94 100644 --- a/src/clerk_backend_api/testingtokens.py +++ b/src/clerk_backend_api/testingtokens.py @@ -32,6 +32,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="POST", path="/testing_tokens", @@ -51,13 +53,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateTestingToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -113,6 +120,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="POST", path="/testing_tokens", @@ -132,13 +141,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateTestingToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, diff --git a/src/clerk_backend_api/users.py b/src/clerk_backend_api/users.py index 01594722..97f82e16 100644 --- a/src/clerk_backend_api/users.py +++ b/src/clerk_backend_api/users.py @@ -15,26 +15,9 @@ class Users(BaseSDK): def list( self, *, - email_address: Optional[List[str]] = None, - phone_number: Optional[List[str]] = None, - external_id: Optional[List[str]] = None, - username: Optional[List[str]] = None, - web3_wallet: Optional[List[str]] = None, - user_id: Optional[List[str]] = None, - organization_id: Optional[List[str]] = None, - query: Optional[str] = None, - email_address_query: Optional[str] = None, - phone_number_query: Optional[str] = None, - username_query: Optional[str] = None, - name_query: Optional[str] = None, - last_active_at_before: Optional[int] = None, - last_active_at_after: Optional[int] = None, - last_active_at_since: Optional[int] = None, - created_at_before: Optional[int] = None, - created_at_after: Optional[int] = None, - limit: Optional[int] = 10, - offset: Optional[int] = 0, - order_by: Optional[str] = "-created_at", + request: Union[ + models.GetUserListRequest, models.GetUserListRequestTypedDict + ] = models.GetUserListRequest(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -45,26 +28,7 @@ def list( Returns a list of all users. The users are returned sorted by creation date, with the newest users appearing first. - :param email_address: Returns users with the specified email addresses. Accepts up to 100 email addresses. Any email addresses not found are ignored. - :param phone_number: Returns users with the specified phone numbers. Accepts up to 100 phone numbers. Any phone numbers not found are ignored. - :param external_id: Returns users with the specified external ids. For each external id, the `+` and `-` can be prepended to the id, which denote whether the respective external id should be included or excluded from the result set. Accepts up to 100 external ids. Any external ids not found are ignored. - :param username: Returns users with the specified usernames. Accepts up to 100 usernames. Any usernames not found are ignored. - :param web3_wallet: Returns users with the specified web3 wallet addresses. Accepts up to 100 web3 wallet addresses. Any web3 wallet addressed not found are ignored. - :param user_id: Returns users with the user ids specified. For each user id, the `+` and `-` can be prepended to the id, which denote whether the respective user id should be included or excluded from the result set. Accepts up to 100 user ids. Any user ids not found are ignored. - :param organization_id: Returns users that have memberships to the given organizations. For each organization id, the `+` and `-` can be prepended to the id, which denote whether the respective organization should be included or excluded from the result set. Accepts up to 100 organization ids. - :param query: Returns users that match the given query. For possible matches, we check the email addresses, phone numbers, usernames, web3 wallets, user ids, first and last names. The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well. - :param email_address_query: Returns users with emails that match the given query, via case-insensitive partial match. For example, `email_address_query=ello` will match a user with the email `HELLO@example.com`. - :param phone_number_query: Returns users with phone numbers that match the given query, via case-insensitive partial match. For example, `phone_number_query=555` will match a user with the phone number `+1555xxxxxxx`. - :param username_query: Returns users with usernames that match the given query, via case-insensitive partial match. For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`. - :param name_query: Returns users with names that match the given query, via case-insensitive partial match. - :param last_active_at_before: Returns users whose last session activity was before the given date (with millisecond precision). Example: use 1700690400000 to retrieve users whose last session activity was before 2023-11-23. - :param last_active_at_after: Returns users whose last session activity was after the given date (with millisecond precision). Example: use 1700690400000 to retrieve users whose last session activity was after 2023-11-23. - :param last_active_at_since: Returns users that had session activity since the given date. Example: use 1700690400000 to retrieve users that had session activity from 2023-11-23 until the current day. Deprecated in favor of `last_active_at_after`. - :param created_at_before: Returns users who have been created before the given date (with millisecond precision). Example: use 1730160000000 to retrieve users who have been created before 2024-10-29. - :param created_at_after: Returns users who have been created after the given date (with millisecond precision). Example: use 1730160000000 to retrieve users who have been created after 2024-10-29. - :param limit: Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`. - :param offset: Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`. - :param order_by: Allows to return users in a particular order. At the moment, you can order the returned users by their `created_at`,`updated_at`,`email_address`,`web3wallet`,`first_name`,`last_name`,`phone_number`,`username`,`last_active_at`,`last_sign_in_at`. In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by. For example, if you want users to be returned in descending order according to their `created_at` property, you can use `-created_at`. If you don't use `+` or `-`, then `+` is implied. We only support one `order_by` parameter, and if multiple `order_by` parameters are provided, we will only keep the first one. For example, if you pass `order_by=username&order_by=created_at`, we will consider only the first `order_by` parameter, which is `username`. The `created_at` parameter will be ignored in this case. + :param request: The request object to send. :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 @@ -77,29 +41,12 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) - request = models.GetUserListRequest( - email_address=email_address, - phone_number=phone_number, - external_id=external_id, - username=username, - web3_wallet=web3_wallet, - user_id=user_id, - organization_id=organization_id, - query=query, - email_address_query=email_address_query, - phone_number_query=phone_number_query, - username_query=username_query, - name_query=name_query, - last_active_at_before=last_active_at_before, - last_active_at_after=last_active_at_after, - last_active_at_since=last_active_at_since, - created_at_before=created_at_before, - created_at_after=created_at_after, - limit=limit, - offset=offset, - order_by=order_by, - ) + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, models.GetUserListRequest) + request = cast(models.GetUserListRequest, request) req = self._build_request( method="GET", @@ -120,13 +67,18 @@ def list( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetUserList", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -136,12 +88,12 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[List[models.User]]) if utils.match_response(http_res, ["400", "401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -165,26 +117,9 @@ def list( async def list_async( self, *, - email_address: Optional[List[str]] = None, - phone_number: Optional[List[str]] = None, - external_id: Optional[List[str]] = None, - username: Optional[List[str]] = None, - web3_wallet: Optional[List[str]] = None, - user_id: Optional[List[str]] = None, - organization_id: Optional[List[str]] = None, - query: Optional[str] = None, - email_address_query: Optional[str] = None, - phone_number_query: Optional[str] = None, - username_query: Optional[str] = None, - name_query: Optional[str] = None, - last_active_at_before: Optional[int] = None, - last_active_at_after: Optional[int] = None, - last_active_at_since: Optional[int] = None, - created_at_before: Optional[int] = None, - created_at_after: Optional[int] = None, - limit: Optional[int] = 10, - offset: Optional[int] = 0, - order_by: Optional[str] = "-created_at", + request: Union[ + models.GetUserListRequest, models.GetUserListRequestTypedDict + ] = models.GetUserListRequest(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -195,26 +130,7 @@ async def list_async( Returns a list of all users. The users are returned sorted by creation date, with the newest users appearing first. - :param email_address: Returns users with the specified email addresses. Accepts up to 100 email addresses. Any email addresses not found are ignored. - :param phone_number: Returns users with the specified phone numbers. Accepts up to 100 phone numbers. Any phone numbers not found are ignored. - :param external_id: Returns users with the specified external ids. For each external id, the `+` and `-` can be prepended to the id, which denote whether the respective external id should be included or excluded from the result set. Accepts up to 100 external ids. Any external ids not found are ignored. - :param username: Returns users with the specified usernames. Accepts up to 100 usernames. Any usernames not found are ignored. - :param web3_wallet: Returns users with the specified web3 wallet addresses. Accepts up to 100 web3 wallet addresses. Any web3 wallet addressed not found are ignored. - :param user_id: Returns users with the user ids specified. For each user id, the `+` and `-` can be prepended to the id, which denote whether the respective user id should be included or excluded from the result set. Accepts up to 100 user ids. Any user ids not found are ignored. - :param organization_id: Returns users that have memberships to the given organizations. For each organization id, the `+` and `-` can be prepended to the id, which denote whether the respective organization should be included or excluded from the result set. Accepts up to 100 organization ids. - :param query: Returns users that match the given query. For possible matches, we check the email addresses, phone numbers, usernames, web3 wallets, user ids, first and last names. The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well. - :param email_address_query: Returns users with emails that match the given query, via case-insensitive partial match. For example, `email_address_query=ello` will match a user with the email `HELLO@example.com`. - :param phone_number_query: Returns users with phone numbers that match the given query, via case-insensitive partial match. For example, `phone_number_query=555` will match a user with the phone number `+1555xxxxxxx`. - :param username_query: Returns users with usernames that match the given query, via case-insensitive partial match. For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`. - :param name_query: Returns users with names that match the given query, via case-insensitive partial match. - :param last_active_at_before: Returns users whose last session activity was before the given date (with millisecond precision). Example: use 1700690400000 to retrieve users whose last session activity was before 2023-11-23. - :param last_active_at_after: Returns users whose last session activity was after the given date (with millisecond precision). Example: use 1700690400000 to retrieve users whose last session activity was after 2023-11-23. - :param last_active_at_since: Returns users that had session activity since the given date. Example: use 1700690400000 to retrieve users that had session activity from 2023-11-23 until the current day. Deprecated in favor of `last_active_at_after`. - :param created_at_before: Returns users who have been created before the given date (with millisecond precision). Example: use 1730160000000 to retrieve users who have been created before 2024-10-29. - :param created_at_after: Returns users who have been created after the given date (with millisecond precision). Example: use 1730160000000 to retrieve users who have been created after 2024-10-29. - :param limit: Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`. - :param offset: Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`. - :param order_by: Allows to return users in a particular order. At the moment, you can order the returned users by their `created_at`,`updated_at`,`email_address`,`web3wallet`,`first_name`,`last_name`,`phone_number`,`username`,`last_active_at`,`last_sign_in_at`. In order to specify the direction, you can use the `+/-` symbols prepended in the property to order by. For example, if you want users to be returned in descending order according to their `created_at` property, you can use `-created_at`. If you don't use `+` or `-`, then `+` is implied. We only support one `order_by` parameter, and if multiple `order_by` parameters are provided, we will only keep the first one. For example, if you pass `order_by=username&order_by=created_at`, we will consider only the first `order_by` parameter, which is `username`. The `created_at` parameter will be ignored in this case. + :param request: The request object to send. :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 @@ -227,29 +143,12 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) - request = models.GetUserListRequest( - email_address=email_address, - phone_number=phone_number, - external_id=external_id, - username=username, - web3_wallet=web3_wallet, - user_id=user_id, - organization_id=organization_id, - query=query, - email_address_query=email_address_query, - phone_number_query=phone_number_query, - username_query=username_query, - name_query=name_query, - last_active_at_before=last_active_at_before, - last_active_at_after=last_active_at_after, - last_active_at_since=last_active_at_since, - created_at_before=created_at_before, - created_at_after=created_at_after, - limit=limit, - offset=offset, - order_by=order_by, - ) + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, models.GetUserListRequest) + request = cast(models.GetUserListRequest, request) req = self._build_request_async( method="GET", @@ -270,13 +169,18 @@ async def list_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetUserList", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -286,12 +190,12 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[List[models.User]]) if utils.match_response(http_res, ["400", "401", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -346,6 +250,8 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateUserRequestBody) @@ -373,13 +279,18 @@ def create( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -389,14 +300,14 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response( http_res, ["400", "401", "403", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -451,6 +362,8 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateUserRequestBody) @@ -478,13 +391,18 @@ async def create_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -494,14 +412,14 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response( http_res, ["400", "401", "403", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -535,6 +453,7 @@ def count( email_address_query: Optional[str] = None, phone_number_query: Optional[str] = None, username_query: Optional[str] = None, + banned: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -554,6 +473,7 @@ def count( :param email_address_query: Counts users with emails that match the given query, via case-insensitive partial match. For example, `email_address_query=ello` will match a user with the email `HELLO@example.com`, and will be included in the resulting count. :param phone_number_query: Counts users with phone numbers that match the given query, via case-insensitive partial match. For example, `phone_number_query=555` will match a user with the phone number `+1555xxxxxxx`, and will be included in the resulting count. :param username_query: Counts users with usernames that match the given query, via case-insensitive partial match. For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`, and will be included in the resulting count. + :param banned: Counts users which are either banned (`banned=true`) or not banned (`banned=false`). :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 @@ -566,6 +486,8 @@ def count( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetUsersCountRequest( email_address=email_address, @@ -578,6 +500,7 @@ def count( email_address_query=email_address_query, phone_number_query=phone_number_query, username_query=username_query, + banned=banned, ) req = self._build_request( @@ -599,13 +522,18 @@ def count( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetUsersCount", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -615,12 +543,12 @@ def count( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.TotalCount]) if utils.match_response(http_res, "422", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -654,6 +582,7 @@ async def count_async( email_address_query: Optional[str] = None, phone_number_query: Optional[str] = None, username_query: Optional[str] = None, + banned: Optional[bool] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -673,6 +602,7 @@ async def count_async( :param email_address_query: Counts users with emails that match the given query, via case-insensitive partial match. For example, `email_address_query=ello` will match a user with the email `HELLO@example.com`, and will be included in the resulting count. :param phone_number_query: Counts users with phone numbers that match the given query, via case-insensitive partial match. For example, `phone_number_query=555` will match a user with the phone number `+1555xxxxxxx`, and will be included in the resulting count. :param username_query: Counts users with usernames that match the given query, via case-insensitive partial match. For example, `username_query=CoolUser` will match a user with the username `SomeCoolUser`, and will be included in the resulting count. + :param banned: Counts users which are either banned (`banned=true`) or not banned (`banned=false`). :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 @@ -685,6 +615,8 @@ async def count_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetUsersCountRequest( email_address=email_address, @@ -697,6 +629,7 @@ async def count_async( email_address_query=email_address_query, phone_number_query=phone_number_query, username_query=username_query, + banned=banned, ) req = self._build_request_async( @@ -718,13 +651,18 @@ async def count_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetUsersCount", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -734,12 +672,12 @@ async def count_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.TotalCount]) if utils.match_response(http_res, "422", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -786,6 +724,8 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetUserRequest( user_id=user_id, @@ -810,13 +750,18 @@ def get( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -826,12 +771,12 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -878,6 +823,8 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetUserRequest( user_id=user_id, @@ -902,13 +849,18 @@ async def get_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -918,12 +870,12 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1031,6 +983,8 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateUserRequest( user_id=user_id, @@ -1085,13 +1039,18 @@ def update( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1101,14 +1060,14 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1216,6 +1175,8 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateUserRequest( user_id=user_id, @@ -1270,13 +1231,18 @@ async def update_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1286,14 +1252,14 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1340,6 +1306,8 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteUserRequest( user_id=user_id, @@ -1364,13 +1332,18 @@ def delete( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1380,12 +1353,12 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1432,6 +1405,8 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteUserRequest( user_id=user_id, @@ -1456,13 +1431,18 @@ async def delete_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1472,12 +1452,12 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1524,6 +1504,8 @@ def ban( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.BanUserRequest( user_id=user_id, @@ -1548,13 +1530,18 @@ def ban( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="BanUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1564,12 +1551,12 @@ def ban( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "402", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1616,6 +1603,8 @@ async def ban_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.BanUserRequest( user_id=user_id, @@ -1640,13 +1629,18 @@ async def ban_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="BanUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1656,12 +1650,12 @@ async def ban_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "402", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1708,6 +1702,8 @@ def unban( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UnbanUserRequest( user_id=user_id, @@ -1732,13 +1728,18 @@ def unban( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UnbanUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1748,12 +1749,12 @@ def unban( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "402", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1800,6 +1801,8 @@ async def unban_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UnbanUserRequest( user_id=user_id, @@ -1824,13 +1827,18 @@ async def unban_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UnbanUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1840,12 +1848,12 @@ async def unban_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "402", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -1893,6 +1901,8 @@ def lock( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.LockUserRequest( user_id=user_id, @@ -1917,13 +1927,18 @@ def lock( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="LockUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -1933,12 +1948,12 @@ def lock( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -1986,6 +2001,8 @@ async def lock_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.LockUserRequest( user_id=user_id, @@ -2010,13 +2027,18 @@ async def lock_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="LockUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2026,12 +2048,12 @@ async def lock_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -2078,6 +2100,8 @@ def unlock( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UnlockUserRequest( user_id=user_id, @@ -2102,13 +2126,18 @@ def unlock( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UnlockUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2118,12 +2147,12 @@ def unlock( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -2170,6 +2199,8 @@ async def unlock_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UnlockUserRequest( user_id=user_id, @@ -2194,13 +2225,18 @@ async def unlock_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UnlockUser", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2210,12 +2246,12 @@ async def unlock_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -2264,6 +2300,8 @@ def set_profile_image( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.SetUserProfileImageRequest( user_id=user_id, @@ -2298,13 +2336,18 @@ def set_profile_image( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="SetUserProfileImage", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2314,12 +2357,12 @@ def set_profile_image( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -2368,6 +2411,8 @@ async def set_profile_image_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.SetUserProfileImageRequest( user_id=user_id, @@ -2402,13 +2447,18 @@ async def set_profile_image_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="SetUserProfileImage", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2418,12 +2468,12 @@ async def set_profile_image_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, ["400", "401", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -2470,6 +2520,8 @@ def delete_profile_image( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteUserProfileImageRequest( user_id=user_id, @@ -2494,13 +2546,18 @@ def delete_profile_image( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteUserProfileImage", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2510,12 +2567,12 @@ def delete_profile_image( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -2562,6 +2619,8 @@ async def delete_profile_image_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteUserProfileImageRequest( user_id=user_id, @@ -2586,13 +2645,18 @@ async def delete_profile_image_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteUserProfileImage", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2602,12 +2666,12 @@ async def delete_profile_image_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -2667,6 +2731,8 @@ def update_metadata( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateUserMetadataRequest( user_id=user_id, @@ -2703,13 +2769,18 @@ def update_metadata( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateUserMetadata", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2719,14 +2790,14 @@ def update_metadata( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -2786,6 +2857,8 @@ async def update_metadata_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UpdateUserMetadataRequest( user_id=user_id, @@ -2822,13 +2895,18 @@ async def update_metadata_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UpdateUserMetadata", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2838,14 +2916,14 @@ async def update_metadata_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.User]) if utils.match_response( http_res, ["400", "401", "404", "422"], "application/json" ): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -2895,6 +2973,8 @@ def get_o_auth_access_token( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOAuthAccessTokenRequest( user_id=user_id, @@ -2920,13 +3000,18 @@ def get_o_auth_access_token( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetOAuthAccessToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -2936,14 +3021,14 @@ def get_o_auth_access_token( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[List[models.ResponseBody]] ) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -2993,6 +3078,8 @@ async def get_o_auth_access_token_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOAuthAccessTokenRequest( user_id=user_id, @@ -3018,13 +3105,18 @@ async def get_o_auth_access_token_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GetOAuthAccessToken", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3034,14 +3126,14 @@ async def get_o_auth_access_token_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[List[models.ResponseBody]] ) if utils.match_response(http_res, ["400", "404", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -3092,6 +3184,8 @@ def get_organization_memberships( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UsersGetOrganizationMembershipsRequest( user_id=user_id, @@ -3118,13 +3212,18 @@ def get_organization_memberships( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UsersGetOrganizationMemberships", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3134,14 +3233,14 @@ def get_organization_memberships( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMemberships] ) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -3192,6 +3291,8 @@ async def get_organization_memberships_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UsersGetOrganizationMembershipsRequest( user_id=user_id, @@ -3218,13 +3319,18 @@ async def get_organization_memberships_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UsersGetOrganizationMemberships", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3234,14 +3340,14 @@ async def get_organization_memberships_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationMemberships] ) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -3294,6 +3400,8 @@ def get_organization_invitations( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UsersGetOrganizationInvitationsRequest( user_id=user_id, @@ -3321,13 +3429,18 @@ def get_organization_invitations( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UsersGetOrganizationInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3337,15 +3450,15 @@ def get_organization_invitations( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitationsWithPublicOrganizationData], ) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -3398,6 +3511,8 @@ async def get_organization_invitations_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UsersGetOrganizationInvitationsRequest( user_id=user_id, @@ -3425,13 +3540,18 @@ async def get_organization_invitations_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UsersGetOrganizationInvitations", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3441,15 +3561,15 @@ async def get_organization_invitations_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.OrganizationInvitationsWithPublicOrganizationData], ) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -3499,6 +3619,8 @@ def verify_password( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.VerifyPasswordRequest( user_id=user_id, @@ -3533,13 +3655,18 @@ def verify_password( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifyPassword", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3549,19 +3676,19 @@ def verify_password( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.VerifyPasswordResponseBody] ) + if utils.match_response(http_res, "500", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, ["400", "404", "422", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res ) - if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -3606,6 +3733,8 @@ async def verify_password_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.VerifyPasswordRequest( user_id=user_id, @@ -3640,13 +3769,18 @@ async def verify_password_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifyPassword", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3656,19 +3790,19 @@ async def verify_password_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.VerifyPasswordResponseBody] ) + if utils.match_response(http_res, "500", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, ["400", "404", "422", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res ) - if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -3715,6 +3849,8 @@ def verify_totp( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.VerifyTOTPRequest( user_id=user_id, @@ -3749,13 +3885,18 @@ def verify_totp( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifyTOTP", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3765,19 +3906,19 @@ def verify_totp( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.VerifyTOTPResponseBody] ) + if utils.match_response(http_res, "500", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, ["400", "404", "422", "4XX"], "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res ) - if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -3824,6 +3965,8 @@ async def verify_totp_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.VerifyTOTPRequest( user_id=user_id, @@ -3858,13 +4001,18 @@ async def verify_totp_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="VerifyTOTP", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3874,19 +4022,19 @@ async def verify_totp_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.VerifyTOTPResponseBody] ) + if utils.match_response(http_res, "500", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, ["400", "404", "422", "4XX"], "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res ) - if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -3928,6 +4076,8 @@ def disable_mfa( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DisableMFARequest( user_id=user_id, @@ -3952,13 +4102,18 @@ def disable_mfa( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DisableMFA", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -3968,17 +4123,17 @@ def disable_mfa( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.DisableMFAResponseBody] ) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -4025,6 +4180,8 @@ async def disable_mfa_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DisableMFARequest( user_id=user_id, @@ -4049,13 +4206,18 @@ async def disable_mfa_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DisableMFA", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -4065,17 +4227,17 @@ async def disable_mfa_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.DisableMFAResponseBody] ) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -4122,6 +4284,8 @@ def delete_backup_codes( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteBackupCodeRequest( user_id=user_id, @@ -4146,13 +4310,18 @@ def delete_backup_codes( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteBackupCode", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -4162,17 +4331,17 @@ def delete_backup_codes( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.DeleteBackupCodeResponseBody] ) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -4219,6 +4388,8 @@ async def delete_backup_codes_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteBackupCodeRequest( user_id=user_id, @@ -4243,13 +4414,18 @@ async def delete_backup_codes_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteBackupCode", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -4259,17 +4435,17 @@ async def delete_backup_codes_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.DeleteBackupCodeResponseBody] ) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -4318,6 +4494,8 @@ def delete_passkey( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UserPasskeyDeleteRequest( user_id=user_id, @@ -4343,13 +4521,18 @@ def delete_passkey( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UserPasskeyDelete", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -4359,15 +4542,15 @@ def delete_passkey( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -4416,6 +4599,8 @@ async def delete_passkey_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UserPasskeyDeleteRequest( user_id=user_id, @@ -4441,13 +4626,18 @@ async def delete_passkey_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UserPasskeyDelete", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -4457,15 +4647,15 @@ async def delete_passkey_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -4514,6 +4704,8 @@ def delete_web3_wallet( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UserWeb3WalletDeleteRequest( user_id=user_id, @@ -4539,13 +4731,18 @@ def delete_web3_wallet( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UserWeb3WalletDelete", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -4555,15 +4752,15 @@ def delete_web3_wallet( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -4612,6 +4809,8 @@ async def delete_web3_wallet_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.UserWeb3WalletDeleteRequest( user_id=user_id, @@ -4637,13 +4836,18 @@ async def delete_web3_wallet_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="UserWeb3WalletDelete", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -4653,207 +4857,15 @@ async def delete_web3_wallet_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) - if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - def create_totp( - self, - *, - user_id: str, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[models.Totp]: - r"""Create a TOTP for a user - - Creates a TOTP (Time-based One-Time Password) for a given user, returning both the TOTP secret and the URI. - - - :param user_id: The ID of the user for whom the TOTP is being created. - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - - request = models.CreateUserTOTPRequest( - user_id=user_id, - ) - - req = self._build_request( - method="POST", - path="/users/{user_id}/totp", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - operation_id="CreateUserTOTP", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["403", "404", "4XX", "500", "5XX"], - retry_config=retry_config, - ) - - data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Optional[models.Totp]) - if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) - if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - async def create_totp_async( - self, - *, - user_id: str, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[models.Totp]: - r"""Create a TOTP for a user - - Creates a TOTP (Time-based One-Time Password) for a given user, returning both the TOTP secret and the URI. - - - :param user_id: The ID of the user for whom the TOTP is being created. - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - - request = models.CreateUserTOTPRequest( - user_id=user_id, - ) - - req = self._build_request_async( - method="POST", - path="/users/{user_id}/totp", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - operation_id="CreateUserTOTP", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["403", "404", "4XX", "500", "5XX"], - retry_config=retry_config, - ) - - data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Optional[models.Totp]) - if utils.match_response(http_res, ["403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -4900,6 +4912,8 @@ def delete_totp( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteTOTPRequest( user_id=user_id, @@ -4924,13 +4938,18 @@ def delete_totp( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteTOTP", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -4940,17 +4959,17 @@ def delete_totp( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.DeleteTOTPResponseBody] ) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -4997,6 +5016,8 @@ async def delete_totp_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteTOTPRequest( user_id=user_id, @@ -5021,13 +5042,18 @@ async def delete_totp_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteTOTP", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -5037,17 +5063,17 @@ async def delete_totp_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json( http_res.text, Optional[models.DeleteTOTPResponseBody] ) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -5096,6 +5122,8 @@ def delete_external_account( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteExternalAccountRequest( user_id=user_id, @@ -5121,13 +5149,18 @@ def delete_external_account( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteExternalAccount", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -5137,15 +5170,15 @@ def delete_external_account( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -5194,6 +5227,8 @@ async def delete_external_account_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.DeleteExternalAccountRequest( user_id=user_id, @@ -5219,13 +5254,18 @@ async def delete_external_account_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteExternalAccount", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -5235,15 +5275,15 @@ async def delete_external_account_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.DeletedObject]) if utils.match_response(http_res, ["400", "403", "404"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/utils/__init__.py b/src/clerk_backend_api/utils/__init__.py index 26d51ae8..3cded8fe 100644 --- a/src/clerk_backend_api/utils/__init__.py +++ b/src/clerk_backend_api/utils/__init__.py @@ -42,6 +42,7 @@ match_content_type, match_status_codes, match_response, + cast_partial, ) from .logger import Logger, get_body_content, get_default_logger @@ -94,4 +95,5 @@ "validate_float", "validate_int", "validate_open_enum", + "cast_partial", ] diff --git a/src/clerk_backend_api/utils/values.py b/src/clerk_backend_api/utils/values.py index 2b4b6832..dae01a44 100644 --- a/src/clerk_backend_api/utils/values.py +++ b/src/clerk_backend_api/utils/values.py @@ -3,8 +3,9 @@ from datetime import datetime from enum import Enum from email.message import Message +from functools import partial import os -from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union +from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union, cast from httpx import Response from pydantic import BaseModel @@ -51,6 +52,8 @@ def match_status_codes(status_codes: List[str], status_code: int) -> bool: T = TypeVar("T") +def cast_partial(typ): + return partial(cast, typ) def get_global_from_env( value: Optional[T], env_key: str, type_cast: Callable[[str], T] diff --git a/src/clerk_backend_api/waitlist_entries_sdk.py b/src/clerk_backend_api/waitlist_entries_sdk.py index 59605502..f1a7e6fd 100644 --- a/src/clerk_backend_api/waitlist_entries_sdk.py +++ b/src/clerk_backend_api/waitlist_entries_sdk.py @@ -29,7 +29,7 @@ def list_waitlist_entries( :param limit: Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`. :param offset: Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`. - :param query: Filter waitlist entries by email address + :param query: Filter waitlist entries by `email_address` or `id` :param status: Filter waitlist entries by their status :param order_by: Specify the order of results. Supported values are: - `created_at` - `email_address` - `invited_at` Use `+` for ascending or `-` for descending order. Defaults to `-created_at`. :param retries: Override the default retry configuration for this method @@ -44,6 +44,8 @@ def list_waitlist_entries( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListWaitlistEntriesRequest( limit=limit, @@ -72,13 +74,18 @@ def list_waitlist_entries( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListWaitlistEntries", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -131,7 +138,7 @@ async def list_waitlist_entries_async( :param limit: Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`. :param offset: Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`. - :param query: Filter waitlist entries by email address + :param query: Filter waitlist entries by `email_address` or `id` :param status: Filter waitlist entries by their status :param order_by: Specify the order of results. Supported values are: - `created_at` - `email_address` - `invited_at` Use `+` for ascending or `-` for descending order. Defaults to `-created_at`. :param retries: Override the default retry configuration for this method @@ -146,6 +153,8 @@ async def list_waitlist_entries_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListWaitlistEntriesRequest( limit=limit, @@ -174,13 +183,18 @@ async def list_waitlist_entries_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="ListWaitlistEntries", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -244,6 +258,8 @@ def create_waitlist_entry( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -277,13 +293,18 @@ def create_waitlist_entry( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateWaitlistEntry", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -293,12 +314,12 @@ def create_waitlist_entry( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.WaitlistEntry]) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -351,6 +372,8 @@ async def create_waitlist_entry_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -384,13 +407,18 @@ async def create_waitlist_entry_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateWaitlistEntry", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -400,12 +428,12 @@ async def create_waitlist_entry_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.WaitlistEntry]) if utils.match_response(http_res, ["400", "422"], "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( diff --git a/src/clerk_backend_api/webhooks.py b/src/clerk_backend_api/webhooks.py index 93a473a9..ea999278 100644 --- a/src/clerk_backend_api/webhooks.py +++ b/src/clerk_backend_api/webhooks.py @@ -36,6 +36,8 @@ def create_svix_app( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="POST", path="/webhooks/svix", @@ -55,13 +57,18 @@ def create_svix_app( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSvixApp", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -71,12 +78,12 @@ def create_svix_app( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SvixURL]) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -121,6 +128,8 @@ async def create_svix_app_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="POST", path="/webhooks/svix", @@ -140,13 +149,18 @@ async def create_svix_app_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="CreateSvixApp", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -156,12 +170,12 @@ async def create_svix_app_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SvixURL]) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -206,6 +220,8 @@ def delete_svix_app( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="DELETE", path="/webhooks/svix", @@ -225,13 +241,18 @@ def delete_svix_app( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteSvixApp", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -241,12 +262,12 @@ def delete_svix_app( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -291,6 +312,8 @@ async def delete_svix_app_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="DELETE", path="/webhooks/svix", @@ -310,13 +333,18 @@ async def delete_svix_app_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="DeleteSvixApp", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -326,12 +354,12 @@ async def delete_svix_app_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( @@ -376,6 +404,8 @@ def generate_svix_auth_url( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request( method="POST", path="/webhooks/svix_url", @@ -395,13 +425,18 @@ def generate_svix_auth_url( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GenerateSvixAuthURL", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -411,12 +446,12 @@ def generate_svix_auth_url( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SvixURL]) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( @@ -461,6 +496,8 @@ async def generate_svix_auth_url_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) req = self._build_request_async( method="POST", path="/webhooks/svix_url", @@ -480,13 +517,18 @@ async def generate_svix_auth_url_async( if retries == UNSET: if self.sdk_configuration.retry_config is not UNSET: retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) retry_config = None if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) + retry_config = (retries, ["5XX"]) http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="GenerateSvixAuthURL", oauth2_scopes=[], security_source=self.sdk_configuration.security, @@ -496,12 +538,12 @@ async def generate_svix_auth_url_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return utils.unmarshal_json(http_res.text, Optional[models.SvixURL]) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) - raise models.ClerkErrors(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ClerkErrorsData) + raise models.ClerkErrors(data=response_data) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError(