appwrite-console 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- appwrite_console/__init__.py +1 -0
- appwrite_console/client.py +371 -0
- appwrite_console/encoders/__init__.py +1 -0
- appwrite_console/encoders/value_class_encoder.py +373 -0
- appwrite_console/enums/__init__.py +1 -0
- appwrite_console/enums/account_key_scopes.py +6 -0
- appwrite_console/enums/adapter.py +5 -0
- appwrite_console/enums/addon.py +7 -0
- appwrite_console/enums/appwrite_migration_resource.py +42 -0
- appwrite_console/enums/attribute_status.py +8 -0
- appwrite_console/enums/authentication_factor.py +7 -0
- appwrite_console/enums/authenticator_type.py +4 -0
- appwrite_console/enums/backup_services.py +10 -0
- appwrite_console/enums/billing_plan_group.py +6 -0
- appwrite_console/enums/block_mode.py +5 -0
- appwrite_console/enums/block_resource_type.py +12 -0
- appwrite_console/enums/browser.py +17 -0
- appwrite_console/enums/browser_permission.py +23 -0
- appwrite_console/enums/browser_theme.py +5 -0
- appwrite_console/enums/build_runtime.py +95 -0
- appwrite_console/enums/cache_database.py +6 -0
- appwrite_console/enums/cache_target.py +9 -0
- appwrite_console/enums/column_status.py +8 -0
- appwrite_console/enums/compression.py +6 -0
- appwrite_console/enums/console_resource_type.py +4 -0
- appwrite_console/enums/credit_card.py +20 -0
- appwrite_console/enums/database_status.py +17 -0
- appwrite_console/enums/database_type.py +10 -0
- appwrite_console/enums/databases_index_type.py +7 -0
- appwrite_console/enums/deployment_download_type.py +5 -0
- appwrite_console/enums/deployment_status.py +9 -0
- appwrite_console/enums/detection_framework_type.py +4 -0
- appwrite_console/enums/detection_runtime_type.py +4 -0
- appwrite_console/enums/documents_db_index_type.py +6 -0
- appwrite_console/enums/domain_purchase_status.py +7 -0
- appwrite_console/enums/domain_registration_type.py +7 -0
- appwrite_console/enums/domain_suggestion_type.py +5 -0
- appwrite_console/enums/domain_transfer_status_enum.py +11 -0
- appwrite_console/enums/embedding_model.py +7 -0
- appwrite_console/enums/execution_method.py +10 -0
- appwrite_console/enums/execution_status.py +8 -0
- appwrite_console/enums/execution_trigger.py +6 -0
- appwrite_console/enums/firebase_migration_resource.py +13 -0
- appwrite_console/enums/flag.py +198 -0
- appwrite_console/enums/framework.py +18 -0
- appwrite_console/enums/function_template_use_case.py +10 -0
- appwrite_console/enums/image_format.py +10 -0
- appwrite_console/enums/image_gravity.py +12 -0
- appwrite_console/enums/index_status.py +8 -0
- appwrite_console/enums/message_priority.py +5 -0
- appwrite_console/enums/message_status.py +8 -0
- appwrite_console/enums/messaging_provider_type.py +6 -0
- appwrite_console/enums/n_host_migration_resource.py +14 -0
- appwrite_console/enums/o_auth2_google_prompt.py +6 -0
- appwrite_console/enums/o_auth2_oidc_prompt.py +7 -0
- appwrite_console/enums/o_auth_provider.py +47 -0
- appwrite_console/enums/on_duplicate.py +6 -0
- appwrite_console/enums/order_by.py +5 -0
- appwrite_console/enums/organization_key_scopes.py +19 -0
- appwrite_console/enums/password_hash.py +14 -0
- appwrite_console/enums/platform.py +5 -0
- appwrite_console/enums/platform_type.py +8 -0
- appwrite_console/enums/project_auth_method_id.py +10 -0
- appwrite_console/enums/project_email_template_id.py +10 -0
- appwrite_console/enums/project_email_template_locale.py +134 -0
- appwrite_console/enums/project_key_scopes.py +107 -0
- appwrite_console/enums/project_o_auth2_google_prompt.py +6 -0
- appwrite_console/enums/project_o_auth2_oidc_prompt.py +7 -0
- appwrite_console/enums/project_o_auth_provider_id.py +47 -0
- appwrite_console/enums/project_policy_id.py +17 -0
- appwrite_console/enums/project_protocol_id.py +6 -0
- appwrite_console/enums/project_service_id.py +22 -0
- appwrite_console/enums/project_smtp_secure.py +5 -0
- appwrite_console/enums/project_usage_range.py +5 -0
- appwrite_console/enums/proxy_resource_type.py +5 -0
- appwrite_console/enums/proxy_rule_deployment_resource_type.py +5 -0
- appwrite_console/enums/proxy_rule_status.py +6 -0
- appwrite_console/enums/query_suggestion_resource.py +97 -0
- appwrite_console/enums/region.py +9 -0
- appwrite_console/enums/relation_mutate.py +6 -0
- appwrite_console/enums/relationship_type.py +7 -0
- appwrite_console/enums/runtime.py +95 -0
- appwrite_console/enums/schedule_resource_type.py +7 -0
- appwrite_console/enums/site_template_use_case.py +12 -0
- appwrite_console/enums/smtp_encryption.py +6 -0
- appwrite_console/enums/status.py +4 -0
- appwrite_console/enums/status_code.py +7 -0
- appwrite_console/enums/supabase_migration_resource.py +14 -0
- appwrite_console/enums/tables_db_index_type.py +7 -0
- appwrite_console/enums/template_reference_type.py +6 -0
- appwrite_console/enums/timezone.py +422 -0
- appwrite_console/enums/usage_range.py +6 -0
- appwrite_console/enums/vcs_detection_type.py +5 -0
- appwrite_console/enums/vcs_reference_type.py +6 -0
- appwrite_console/enums/vectors_db_index_type.py +9 -0
- appwrite_console/enums/waf_rule_action.py +8 -0
- appwrite_console/exception.py +7 -0
- appwrite_console/id.py +26 -0
- appwrite_console/input_file.py +21 -0
- appwrite_console/models/__init__.py +803 -0
- appwrite_console/models/activity_event.py +99 -0
- appwrite_console/models/activity_event_list.py +19 -0
- appwrite_console/models/additional_resource.py +30 -0
- appwrite_console/models/addon.py +42 -0
- appwrite_console/models/addon_list.py +19 -0
- appwrite_console/models/addon_price.py +36 -0
- appwrite_console/models/aggregation_breakdown.py +28 -0
- appwrite_console/models/aggregation_team.py +101 -0
- appwrite_console/models/aggregation_team_list.py +19 -0
- appwrite_console/models/algo_argon2.py +24 -0
- appwrite_console/models/algo_bcrypt.py +15 -0
- appwrite_console/models/algo_md5.py +15 -0
- appwrite_console/models/algo_phpass.py +15 -0
- appwrite_console/models/algo_scrypt.py +27 -0
- appwrite_console/models/algo_scrypt_modified.py +24 -0
- appwrite_console/models/algo_sha.py +15 -0
- appwrite_console/models/app.py +91 -0
- appwrite_console/models/app_installation.py +42 -0
- appwrite_console/models/app_installation_list.py +19 -0
- appwrite_console/models/app_key.py +39 -0
- appwrite_console/models/app_key_list.py +19 -0
- appwrite_console/models/app_scope.py +27 -0
- appwrite_console/models/app_scope_list.py +19 -0
- appwrite_console/models/app_secret.py +39 -0
- appwrite_console/models/app_secret_list.py +19 -0
- appwrite_console/models/app_secret_plaintext.py +39 -0
- appwrite_console/models/apps_list.py +19 -0
- appwrite_console/models/attribute_bigint.py +46 -0
- appwrite_console/models/attribute_boolean.py +40 -0
- appwrite_console/models/attribute_datetime.py +43 -0
- appwrite_console/models/attribute_email.py +43 -0
- appwrite_console/models/attribute_enum.py +46 -0
- appwrite_console/models/attribute_float.py +46 -0
- appwrite_console/models/attribute_integer.py +46 -0
- appwrite_console/models/attribute_ip.py +43 -0
- appwrite_console/models/attribute_line.py +40 -0
- appwrite_console/models/attribute_list.py +36 -0
- appwrite_console/models/attribute_longtext.py +43 -0
- appwrite_console/models/attribute_mediumtext.py +43 -0
- appwrite_console/models/attribute_object.py +37 -0
- appwrite_console/models/attribute_point.py +40 -0
- appwrite_console/models/attribute_polygon.py +40 -0
- appwrite_console/models/attribute_relationship.py +55 -0
- appwrite_console/models/attribute_string.py +46 -0
- appwrite_console/models/attribute_text.py +43 -0
- appwrite_console/models/attribute_url.py +43 -0
- appwrite_console/models/attribute_varchar.py +46 -0
- appwrite_console/models/attribute_vector.py +40 -0
- appwrite_console/models/backup_archive.py +48 -0
- appwrite_console/models/backup_archive_list.py +19 -0
- appwrite_console/models/backup_policy.py +48 -0
- appwrite_console/models/backup_policy_list.py +19 -0
- appwrite_console/models/backup_restoration.py +45 -0
- appwrite_console/models/backup_restoration_list.py +19 -0
- appwrite_console/models/base_model.py +27 -0
- appwrite_console/models/billing_address.py +36 -0
- appwrite_console/models/billing_address_list.py +19 -0
- appwrite_console/models/billing_limits.py +36 -0
- appwrite_console/models/billing_plan.py +226 -0
- appwrite_console/models/billing_plan_addon.py +19 -0
- appwrite_console/models/billing_plan_addon_details.py +36 -0
- appwrite_console/models/billing_plan_dedicated_database_limits.py +69 -0
- appwrite_console/models/billing_plan_limits.py +18 -0
- appwrite_console/models/billing_plan_list.py +19 -0
- appwrite_console/models/billing_plan_supported_addons.py +21 -0
- appwrite_console/models/block.py +45 -0
- appwrite_console/models/block_delete.py +19 -0
- appwrite_console/models/block_list.py +19 -0
- appwrite_console/models/branch.py +15 -0
- appwrite_console/models/branch_list.py +19 -0
- appwrite_console/models/bucket.py +54 -0
- appwrite_console/models/bucket_list.py +19 -0
- appwrite_console/models/campaign.py +49 -0
- appwrite_console/models/collection.py +67 -0
- appwrite_console/models/collection_list.py +19 -0
- appwrite_console/models/column_bigint.py +46 -0
- appwrite_console/models/column_boolean.py +40 -0
- appwrite_console/models/column_datetime.py +43 -0
- appwrite_console/models/column_email.py +43 -0
- appwrite_console/models/column_enum.py +46 -0
- appwrite_console/models/column_float.py +46 -0
- appwrite_console/models/column_index.py +42 -0
- appwrite_console/models/column_index_list.py +19 -0
- appwrite_console/models/column_integer.py +46 -0
- appwrite_console/models/column_ip.py +43 -0
- appwrite_console/models/column_line.py +40 -0
- appwrite_console/models/column_list.py +36 -0
- appwrite_console/models/column_longtext.py +43 -0
- appwrite_console/models/column_mediumtext.py +43 -0
- appwrite_console/models/column_point.py +40 -0
- appwrite_console/models/column_polygon.py +40 -0
- appwrite_console/models/column_relationship.py +55 -0
- appwrite_console/models/column_string.py +46 -0
- appwrite_console/models/column_text.py +43 -0
- appwrite_console/models/column_url.py +43 -0
- appwrite_console/models/column_varchar.py +46 -0
- appwrite_console/models/console_key_scope.py +24 -0
- appwrite_console/models/console_key_scope_list.py +19 -0
- appwrite_console/models/console_o_auth2_provider.py +19 -0
- appwrite_console/models/console_o_auth2_provider_list.py +19 -0
- appwrite_console/models/console_o_auth2_provider_parameter.py +24 -0
- appwrite_console/models/console_region.py +30 -0
- appwrite_console/models/console_region_list.py +19 -0
- appwrite_console/models/console_variables.py +96 -0
- appwrite_console/models/continent.py +18 -0
- appwrite_console/models/continent_list.py +19 -0
- appwrite_console/models/country.py +18 -0
- appwrite_console/models/country_list.py +19 -0
- appwrite_console/models/coupon.py +36 -0
- appwrite_console/models/credit.py +45 -0
- appwrite_console/models/credit_available.py +15 -0
- appwrite_console/models/credit_list.py +22 -0
- appwrite_console/models/currency.py +33 -0
- appwrite_console/models/currency_list.py +19 -0
- appwrite_console/models/database.py +52 -0
- appwrite_console/models/database_list.py +19 -0
- appwrite_console/models/database_migration.py +57 -0
- appwrite_console/models/database_migration_list.py +19 -0
- appwrite_console/models/database_status.py +57 -0
- appwrite_console/models/database_status_connections.py +18 -0
- appwrite_console/models/database_status_replica.py +24 -0
- appwrite_console/models/database_status_volume.py +24 -0
- appwrite_console/models/dedicated_database.py +159 -0
- appwrite_console/models/dedicated_database_backup.py +63 -0
- appwrite_console/models/dedicated_database_backup_list.py +19 -0
- appwrite_console/models/dedicated_database_backup_storage.py +27 -0
- appwrite_console/models/dedicated_database_branch.py +48 -0
- appwrite_console/models/dedicated_database_branch_list.py +16 -0
- appwrite_console/models/dedicated_database_execution.py +31 -0
- appwrite_console/models/dedicated_database_execution_column.py +18 -0
- appwrite_console/models/dedicated_database_extensions.py +22 -0
- appwrite_console/models/dedicated_database_list.py +19 -0
- appwrite_console/models/dedicated_database_member.py +24 -0
- appwrite_console/models/dedicated_database_operation.py +45 -0
- appwrite_console/models/dedicated_database_operation_list.py +19 -0
- appwrite_console/models/dedicated_database_pitr_windows.py +18 -0
- appwrite_console/models/dedicated_database_pooler.py +42 -0
- appwrite_console/models/dedicated_database_replicas.py +37 -0
- appwrite_console/models/dedicated_database_restoration.py +45 -0
- appwrite_console/models/dedicated_database_restoration_list.py +19 -0
- appwrite_console/models/dedicated_database_specification.py +39 -0
- appwrite_console/models/dedicated_database_specification_list.py +23 -0
- appwrite_console/models/dedicated_database_specification_pricing.py +27 -0
- appwrite_console/models/deployment.py +94 -0
- appwrite_console/models/deployment_list.py +19 -0
- appwrite_console/models/detection_framework.py +32 -0
- appwrite_console/models/detection_runtime.py +29 -0
- appwrite_console/models/detection_variable.py +18 -0
- appwrite_console/models/dev_key.py +36 -0
- appwrite_console/models/dev_key_list.py +19 -0
- appwrite_console/models/dns_record.py +48 -0
- appwrite_console/models/dns_records_list.py +19 -0
- appwrite_console/models/document.py +80 -0
- appwrite_console/models/document_list.py +32 -0
- appwrite_console/models/domain.py +53 -0
- appwrite_console/models/domain_price.py +30 -0
- appwrite_console/models/domain_purchase.py +43 -0
- appwrite_console/models/domain_suggestion.py +24 -0
- appwrite_console/models/domain_suggestions_list.py +19 -0
- appwrite_console/models/domain_transfer_out.py +15 -0
- appwrite_console/models/domain_transfer_status.py +22 -0
- appwrite_console/models/domains_list.py +19 -0
- appwrite_console/models/downgrade_feedback.py +42 -0
- appwrite_console/models/email_template.py +36 -0
- appwrite_console/models/email_template_list.py +19 -0
- appwrite_console/models/embedding.py +24 -0
- appwrite_console/models/embedding_list.py +19 -0
- appwrite_console/models/ephemeral_key.py +39 -0
- appwrite_console/models/estimation.py +37 -0
- appwrite_console/models/estimation_delete_organization.py +16 -0
- appwrite_console/models/estimation_item.py +18 -0
- appwrite_console/models/estimation_plan_change.py +29 -0
- appwrite_console/models/estimation_update_plan.py +40 -0
- appwrite_console/models/execution.py +69 -0
- appwrite_console/models/execution_list.py +19 -0
- appwrite_console/models/file.py +60 -0
- appwrite_console/models/file_list.py +19 -0
- appwrite_console/models/framework.py +28 -0
- appwrite_console/models/framework_adapter.py +27 -0
- appwrite_console/models/framework_list.py +19 -0
- appwrite_console/models/function.py +109 -0
- appwrite_console/models/function_list.py +19 -0
- appwrite_console/models/headers.py +18 -0
- appwrite_console/models/identity.py +42 -0
- appwrite_console/models/identity_list.py +19 -0
- appwrite_console/models/index.py +43 -0
- appwrite_console/models/index_list.py +19 -0
- appwrite_console/models/insight.py +64 -0
- appwrite_console/models/insight_cta.py +24 -0
- appwrite_console/models/insight_list.py +19 -0
- appwrite_console/models/installation.py +30 -0
- appwrite_console/models/installation_list.py +19 -0
- appwrite_console/models/invoice.py +82 -0
- appwrite_console/models/invoice_list.py +19 -0
- appwrite_console/models/jwt.py +15 -0
- appwrite_console/models/key.py +39 -0
- appwrite_console/models/key_list.py +19 -0
- appwrite_console/models/language.py +21 -0
- appwrite_console/models/language_list.py +19 -0
- appwrite_console/models/locale.py +66 -0
- appwrite_console/models/locale_code.py +18 -0
- appwrite_console/models/locale_code_list.py +19 -0
- appwrite_console/models/log.py +78 -0
- appwrite_console/models/log_list.py +19 -0
- appwrite_console/models/membership.py +57 -0
- appwrite_console/models/membership_list.py +19 -0
- appwrite_console/models/message.py +52 -0
- appwrite_console/models/message_list.py +19 -0
- appwrite_console/models/metric.py +18 -0
- appwrite_console/models/metric_breakdown.py +24 -0
- appwrite_console/models/mfa_challenge.py +24 -0
- appwrite_console/models/mfa_factors.py +24 -0
- appwrite_console/models/mfa_recovery_codes.py +15 -0
- appwrite_console/models/mfa_type.py +18 -0
- appwrite_console/models/migration.py +75 -0
- appwrite_console/models/migration_list.py +19 -0
- appwrite_console/models/migration_report.py +96 -0
- appwrite_console/models/mock_number.py +24 -0
- appwrite_console/models/mock_number_list.py +19 -0
- appwrite_console/models/notification.py +60 -0
- appwrite_console/models/notification_list.py +19 -0
- appwrite_console/models/o_auth2_amazon.py +24 -0
- appwrite_console/models/o_auth2_apple.py +30 -0
- appwrite_console/models/o_auth2_appwrite.py +24 -0
- appwrite_console/models/o_auth2_auth0.py +27 -0
- appwrite_console/models/o_auth2_authentik.py +27 -0
- appwrite_console/models/o_auth2_autodesk.py +24 -0
- appwrite_console/models/o_auth2_bitbucket.py +24 -0
- appwrite_console/models/o_auth2_bitly.py +24 -0
- appwrite_console/models/o_auth2_box.py +24 -0
- appwrite_console/models/o_auth2_dailymotion.py +24 -0
- appwrite_console/models/o_auth2_discord.py +24 -0
- appwrite_console/models/o_auth2_disqus.py +24 -0
- appwrite_console/models/o_auth2_dropbox.py +24 -0
- appwrite_console/models/o_auth2_etsy.py +24 -0
- appwrite_console/models/o_auth2_facebook.py +24 -0
- appwrite_console/models/o_auth2_figma.py +24 -0
- appwrite_console/models/o_auth2_fusion_auth.py +27 -0
- appwrite_console/models/o_auth2_github.py +24 -0
- appwrite_console/models/o_auth2_gitlab.py +27 -0
- appwrite_console/models/o_auth2_google.py +28 -0
- appwrite_console/models/o_auth2_keycloak.py +30 -0
- appwrite_console/models/o_auth2_kick.py +24 -0
- appwrite_console/models/o_auth2_linkedin.py +24 -0
- appwrite_console/models/o_auth2_microsoft.py +27 -0
- appwrite_console/models/o_auth2_notion.py +24 -0
- appwrite_console/models/o_auth2_oidc.py +43 -0
- appwrite_console/models/o_auth2_okta.py +30 -0
- appwrite_console/models/o_auth2_paypal.py +24 -0
- appwrite_console/models/o_auth2_podio.py +24 -0
- appwrite_console/models/o_auth2_provider_list.py +59 -0
- appwrite_console/models/o_auth2_salesforce.py +24 -0
- appwrite_console/models/o_auth2_slack.py +24 -0
- appwrite_console/models/o_auth2_spotify.py +24 -0
- appwrite_console/models/o_auth2_stripe.py +24 -0
- appwrite_console/models/o_auth2_tradeshift.py +24 -0
- appwrite_console/models/o_auth2_twitch.py +24 -0
- appwrite_console/models/o_auth2_word_press.py +24 -0
- appwrite_console/models/o_auth2_x.py +24 -0
- appwrite_console/models/o_auth2_yahoo.py +24 -0
- appwrite_console/models/o_auth2_yandex.py +24 -0
- appwrite_console/models/o_auth2_zoho.py +24 -0
- appwrite_console/models/o_auth2_zoom.py +24 -0
- appwrite_console/models/oauth2_approve.py +15 -0
- appwrite_console/models/oauth2_authorize.py +18 -0
- appwrite_console/models/oauth2_consent.py +42 -0
- appwrite_console/models/oauth2_consent_list.py +19 -0
- appwrite_console/models/oauth2_consent_token.py +45 -0
- appwrite_console/models/oauth2_consent_token_list.py +19 -0
- appwrite_console/models/oauth2_device_authorization.py +30 -0
- appwrite_console/models/oauth2_grant.py +48 -0
- appwrite_console/models/oauth2_organization.py +15 -0
- appwrite_console/models/oauth2_organization_list.py +19 -0
- appwrite_console/models/oauth2_par.py +18 -0
- appwrite_console/models/oauth2_project.py +21 -0
- appwrite_console/models/oauth2_project_list.py +19 -0
- appwrite_console/models/oauth2_reject.py +15 -0
- appwrite_console/models/oauth2_token.py +33 -0
- appwrite_console/models/organization.py +132 -0
- appwrite_console/models/organization_list.py +32 -0
- appwrite_console/models/payment_authentication.py +30 -0
- appwrite_console/models/payment_method.py +72 -0
- appwrite_console/models/payment_method_list.py +19 -0
- appwrite_console/models/phone.py +21 -0
- appwrite_console/models/phone_list.py +19 -0
- appwrite_console/models/plan_change_estimation_details.py +39 -0
- appwrite_console/models/plan_change_limits.py +28 -0
- appwrite_console/models/plan_change_project_compliance.py +28 -0
- appwrite_console/models/plan_change_resource_compliance.py +30 -0
- appwrite_console/models/platform_android.py +31 -0
- appwrite_console/models/platform_apple.py +31 -0
- appwrite_console/models/platform_linux.py +31 -0
- appwrite_console/models/platform_list.py +23 -0
- appwrite_console/models/platform_web.py +31 -0
- appwrite_console/models/platform_windows.py +31 -0
- appwrite_console/models/policy_deny_aliased_email.py +18 -0
- appwrite_console/models/policy_deny_corporate_email.py +18 -0
- appwrite_console/models/policy_deny_disposable_email.py +18 -0
- appwrite_console/models/policy_deny_free_email.py +18 -0
- appwrite_console/models/policy_list.py +32 -0
- appwrite_console/models/policy_membership_privacy.py +33 -0
- appwrite_console/models/policy_password_dictionary.py +18 -0
- appwrite_console/models/policy_password_history.py +18 -0
- appwrite_console/models/policy_password_personal_data.py +18 -0
- appwrite_console/models/policy_password_strength.py +30 -0
- appwrite_console/models/policy_session_alert.py +18 -0
- appwrite_console/models/policy_session_duration.py +18 -0
- appwrite_console/models/policy_session_invalidation.py +18 -0
- appwrite_console/models/policy_session_limit.py +18 -0
- appwrite_console/models/policy_user_limit.py +18 -0
- appwrite_console/models/postgres_extension.py +24 -0
- appwrite_console/models/postgres_extension_list.py +19 -0
- appwrite_console/models/preferences.py +52 -0
- appwrite_console/models/presence.py +39 -0
- appwrite_console/models/presence_list.py +19 -0
- appwrite_console/models/program.py +39 -0
- appwrite_console/models/project.py +153 -0
- appwrite_console/models/project_auth_method.py +19 -0
- appwrite_console/models/project_list.py +19 -0
- appwrite_console/models/project_protocol.py +19 -0
- appwrite_console/models/project_service.py +19 -0
- appwrite_console/models/provider.py +39 -0
- appwrite_console/models/provider_list.py +19 -0
- appwrite_console/models/provider_repository.py +42 -0
- appwrite_console/models/provider_repository_framework.py +45 -0
- appwrite_console/models/provider_repository_framework_list.py +22 -0
- appwrite_console/models/provider_repository_runtime.py +45 -0
- appwrite_console/models/provider_repository_runtime_list.py +22 -0
- appwrite_console/models/proxy_rule.py +59 -0
- appwrite_console/models/proxy_rule_list.py +19 -0
- appwrite_console/models/report.py +49 -0
- appwrite_console/models/report_list.py +19 -0
- appwrite_console/models/resource_token.py +33 -0
- appwrite_console/models/resource_token_list.py +19 -0
- appwrite_console/models/review.py +24 -0
- appwrite_console/models/roles.py +18 -0
- appwrite_console/models/row.py +80 -0
- appwrite_console/models/row_list.py +32 -0
- appwrite_console/models/runtime.py +36 -0
- appwrite_console/models/runtime_list.py +19 -0
- appwrite_console/models/schedule.py +45 -0
- appwrite_console/models/schedule_list.py +19 -0
- appwrite_console/models/session.py +99 -0
- appwrite_console/models/session_list.py +19 -0
- appwrite_console/models/site.py +115 -0
- appwrite_console/models/site_list.py +19 -0
- appwrite_console/models/specification.py +24 -0
- appwrite_console/models/specification_list.py +19 -0
- appwrite_console/models/stage.py +27 -0
- appwrite_console/models/stage_list.py +16 -0
- appwrite_console/models/subscriber.py +40 -0
- appwrite_console/models/subscriber_list.py +19 -0
- appwrite_console/models/table.py +67 -0
- appwrite_console/models/table_list.py +19 -0
- appwrite_console/models/target.py +39 -0
- appwrite_console/models/target_list.py +19 -0
- appwrite_console/models/team.py +43 -0
- appwrite_console/models/team_list.py +32 -0
- appwrite_console/models/template_framework.py +39 -0
- appwrite_console/models/template_function.py +65 -0
- appwrite_console/models/template_function_list.py +19 -0
- appwrite_console/models/template_runtime.py +24 -0
- appwrite_console/models/template_site.py +53 -0
- appwrite_console/models/template_site_list.py +19 -0
- appwrite_console/models/template_variable.py +33 -0
- appwrite_console/models/token.py +30 -0
- appwrite_console/models/topic.py +36 -0
- appwrite_console/models/topic_list.py +19 -0
- appwrite_console/models/transaction.py +30 -0
- appwrite_console/models/transaction_list.py +19 -0
- appwrite_console/models/usage_billing_plan.py +46 -0
- appwrite_console/models/usage_data_point.py +99 -0
- appwrite_console/models/usage_event_list.py +19 -0
- appwrite_console/models/usage_gauge_list.py +19 -0
- appwrite_console/models/usage_metric.py +19 -0
- appwrite_console/models/usage_organization.py +104 -0
- appwrite_console/models/usage_organization_project.py +73 -0
- appwrite_console/models/usage_presence.py +22 -0
- appwrite_console/models/usage_project.py +218 -0
- appwrite_console/models/usage_resources.py +36 -0
- appwrite_console/models/usage_users.py +28 -0
- appwrite_console/models/user.py +111 -0
- appwrite_console/models/user_list.py +32 -0
- appwrite_console/models/variable.py +36 -0
- appwrite_console/models/variable_list.py +19 -0
- appwrite_console/models/vcs_content.py +21 -0
- appwrite_console/models/vcs_content_list.py +19 -0
- appwrite_console/models/vcs_namespace.py +27 -0
- appwrite_console/models/vcs_namespace_list.py +19 -0
- appwrite_console/models/vectorsdb_collection.py +54 -0
- appwrite_console/models/vectorsdb_collection_list.py +19 -0
- appwrite_console/models/waf_rule.py +55 -0
- appwrite_console/models/waf_rule_bypass.py +55 -0
- appwrite_console/models/waf_rule_challenge.py +64 -0
- appwrite_console/models/waf_rule_deny.py +55 -0
- appwrite_console/models/waf_rule_list.py +19 -0
- appwrite_console/models/waf_rule_rate_limit.py +64 -0
- appwrite_console/models/waf_rule_redirect.py +61 -0
- appwrite_console/models/webhook.py +51 -0
- appwrite_console/models/webhook_list.py +19 -0
- appwrite_console/operator.py +150 -0
- appwrite_console/permission.py +21 -0
- appwrite_console/query.py +293 -0
- appwrite_console/role.py +111 -0
- appwrite_console/service.py +50 -0
- appwrite_console/services/__init__.py +1 -0
- appwrite_console/services/account.py +3328 -0
- appwrite_console/services/activities.py +89 -0
- appwrite_console/services/advisor.py +234 -0
- appwrite_console/services/apps.py +1156 -0
- appwrite_console/services/assistant.py +50 -0
- appwrite_console/services/avatars.py +531 -0
- appwrite_console/services/backups.py +572 -0
- appwrite_console/services/console.py +807 -0
- appwrite_console/services/databases.py +4976 -0
- appwrite_console/services/documents_db.py +2052 -0
- appwrite_console/services/domains.py +3047 -0
- appwrite_console/services/functions.py +1659 -0
- appwrite_console/services/graphql.py +92 -0
- appwrite_console/services/locale.py +243 -0
- appwrite_console/services/manager.py +301 -0
- appwrite_console/services/messaging.py +3137 -0
- appwrite_console/services/migrations.py +1036 -0
- appwrite_console/services/mongo.py +1683 -0
- appwrite_console/services/mysql.py +1861 -0
- appwrite_console/services/notifications.py +98 -0
- appwrite_console/services/oauth2.py +914 -0
- appwrite_console/services/organization.py +1039 -0
- appwrite_console/services/organizations.py +2245 -0
- appwrite_console/services/postgresql.py +1995 -0
- appwrite_console/services/presences.py +309 -0
- appwrite_console/services/project.py +5271 -0
- appwrite_console/services/projects.py +885 -0
- appwrite_console/services/proxy.py +394 -0
- appwrite_console/services/sites.py +1593 -0
- appwrite_console/services/storage.py +818 -0
- appwrite_console/services/tables_db.py +5189 -0
- appwrite_console/services/teams.py +993 -0
- appwrite_console/services/tokens.py +243 -0
- appwrite_console/services/usage.py +194 -0
- appwrite_console/services/users.py +2314 -0
- appwrite_console/services/vcs.py +599 -0
- appwrite_console/services/vectors_db.py +2054 -0
- appwrite_console/services/waf.py +1014 -0
- appwrite_console/services/webhooks.py +344 -0
- appwrite_console/utils/__init__.py +1 -0
- appwrite_console/utils/deprecated.py +51 -0
- appwrite_console-0.1.0.dist-info/METADATA +189 -0
- appwrite_console-0.1.0.dist-info/RECORD +552 -0
- appwrite_console-0.1.0.dist-info/WHEEL +5 -0
- appwrite_console-0.1.0.dist-info/licenses/LICENSE +12 -0
- appwrite_console-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2314 @@
|
|
|
1
|
+
from ..service import Service
|
|
2
|
+
from urllib.parse import quote
|
|
3
|
+
from typing import Any, Dict, List, Optional, Union, Type, TypeVar
|
|
4
|
+
from ..exception import AppwriteException
|
|
5
|
+
from appwrite_console.utils.deprecated import deprecated
|
|
6
|
+
from ..models.user_list import UserList
|
|
7
|
+
from ..models.user import User
|
|
8
|
+
from ..models.identity_list import IdentityList
|
|
9
|
+
from ..enums.password_hash import PasswordHash
|
|
10
|
+
from ..enums.usage_range import UsageRange
|
|
11
|
+
from ..models.usage_users import UsageUsers
|
|
12
|
+
from ..models.jwt import Jwt
|
|
13
|
+
from ..models.log_list import LogList
|
|
14
|
+
from ..models.membership_list import MembershipList
|
|
15
|
+
from ..enums.authenticator_type import AuthenticatorType
|
|
16
|
+
from ..models.mfa_factors import MfaFactors
|
|
17
|
+
from ..models.mfa_recovery_codes import MfaRecoveryCodes
|
|
18
|
+
from ..models.preferences import Preferences
|
|
19
|
+
from ..models.session_list import SessionList
|
|
20
|
+
from ..models.session import Session
|
|
21
|
+
from ..models.target_list import TargetList
|
|
22
|
+
from ..enums.messaging_provider_type import MessagingProviderType
|
|
23
|
+
from ..models.target import Target
|
|
24
|
+
from ..models.token import Token
|
|
25
|
+
|
|
26
|
+
T = TypeVar('T')
|
|
27
|
+
|
|
28
|
+
class Users(Service):
|
|
29
|
+
|
|
30
|
+
def __init__(self, client) -> None:
|
|
31
|
+
super(Users, self).__init__(client)
|
|
32
|
+
|
|
33
|
+
def list(
|
|
34
|
+
self,
|
|
35
|
+
queries: Optional[List[str]] = None,
|
|
36
|
+
search: Optional[str] = None,
|
|
37
|
+
total: Optional[bool] = None,
|
|
38
|
+
model_type: Type[T] = dict
|
|
39
|
+
) -> UserList[T]:
|
|
40
|
+
"""
|
|
41
|
+
Get a list of all the project's users. You can use the query params to filter your results.
|
|
42
|
+
|
|
43
|
+
Parameters
|
|
44
|
+
----------
|
|
45
|
+
queries : Optional[List[str]]
|
|
46
|
+
Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator, accessedAt
|
|
47
|
+
search : Optional[str]
|
|
48
|
+
Search term to filter your list results. Max length: 256 chars.
|
|
49
|
+
total : Optional[bool]
|
|
50
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
51
|
+
|
|
52
|
+
model_type : Type[T], optional
|
|
53
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
-------
|
|
57
|
+
UserList[T]
|
|
58
|
+
API response as a typed Pydantic model
|
|
59
|
+
|
|
60
|
+
Raises
|
|
61
|
+
------
|
|
62
|
+
AppwriteException
|
|
63
|
+
If API request fails
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
api_path = '/users'
|
|
67
|
+
api_params = {}
|
|
68
|
+
|
|
69
|
+
if queries is not None:
|
|
70
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
71
|
+
if search is not None:
|
|
72
|
+
api_params['search'] = self._normalize_value(search)
|
|
73
|
+
if total is not None:
|
|
74
|
+
api_params['total'] = self._normalize_value(total)
|
|
75
|
+
|
|
76
|
+
response = self.client.call('get', api_path, {
|
|
77
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
78
|
+
'accept': 'application/json',
|
|
79
|
+
}, api_params)
|
|
80
|
+
|
|
81
|
+
return UserList.with_data(response, model_type)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def create(
|
|
85
|
+
self,
|
|
86
|
+
user_id: str,
|
|
87
|
+
email: Optional[str] = None,
|
|
88
|
+
phone: Optional[str] = None,
|
|
89
|
+
password: Optional[str] = None,
|
|
90
|
+
name: Optional[str] = None,
|
|
91
|
+
model_type: Type[T] = dict
|
|
92
|
+
) -> User[T]:
|
|
93
|
+
"""
|
|
94
|
+
Create a new user.
|
|
95
|
+
|
|
96
|
+
Parameters
|
|
97
|
+
----------
|
|
98
|
+
user_id : str
|
|
99
|
+
User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
100
|
+
email : Optional[str]
|
|
101
|
+
User email.
|
|
102
|
+
phone : Optional[str]
|
|
103
|
+
Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
104
|
+
password : Optional[str]
|
|
105
|
+
Plain text user password. Must be at least 8 chars.
|
|
106
|
+
name : Optional[str]
|
|
107
|
+
User name. Max length: 128 chars.
|
|
108
|
+
|
|
109
|
+
model_type : Type[T], optional
|
|
110
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
User[T]
|
|
115
|
+
API response as a typed Pydantic model
|
|
116
|
+
|
|
117
|
+
Raises
|
|
118
|
+
------
|
|
119
|
+
AppwriteException
|
|
120
|
+
If API request fails
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
api_path = '/users'
|
|
124
|
+
api_params = {}
|
|
125
|
+
if user_id is None:
|
|
126
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
api_params['userId'] = self._normalize_value(user_id)
|
|
130
|
+
if email is not None:
|
|
131
|
+
api_params['email'] = self._normalize_value(email)
|
|
132
|
+
if phone is not None:
|
|
133
|
+
api_params['phone'] = self._normalize_value(phone)
|
|
134
|
+
if password is not None:
|
|
135
|
+
api_params['password'] = self._normalize_value(password)
|
|
136
|
+
if name is not None:
|
|
137
|
+
api_params['name'] = self._normalize_value(name)
|
|
138
|
+
|
|
139
|
+
response = self.client.call('post', api_path, {
|
|
140
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
141
|
+
'content-type': 'application/json',
|
|
142
|
+
'accept': 'application/json',
|
|
143
|
+
}, api_params)
|
|
144
|
+
|
|
145
|
+
return User.with_data(response, model_type)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def create_argon2_user(
|
|
149
|
+
self,
|
|
150
|
+
user_id: str,
|
|
151
|
+
email: str,
|
|
152
|
+
password: str,
|
|
153
|
+
name: Optional[str] = None,
|
|
154
|
+
model_type: Type[T] = dict
|
|
155
|
+
) -> User[T]:
|
|
156
|
+
"""
|
|
157
|
+
Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
158
|
+
|
|
159
|
+
Parameters
|
|
160
|
+
----------
|
|
161
|
+
user_id : str
|
|
162
|
+
User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
163
|
+
email : str
|
|
164
|
+
User email.
|
|
165
|
+
password : str
|
|
166
|
+
User password hashed using Argon2.
|
|
167
|
+
name : Optional[str]
|
|
168
|
+
User name. Max length: 128 chars.
|
|
169
|
+
|
|
170
|
+
model_type : Type[T], optional
|
|
171
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
172
|
+
|
|
173
|
+
Returns
|
|
174
|
+
-------
|
|
175
|
+
User[T]
|
|
176
|
+
API response as a typed Pydantic model
|
|
177
|
+
|
|
178
|
+
Raises
|
|
179
|
+
------
|
|
180
|
+
AppwriteException
|
|
181
|
+
If API request fails
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
api_path = '/users/argon2'
|
|
185
|
+
api_params = {}
|
|
186
|
+
if user_id is None:
|
|
187
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
188
|
+
|
|
189
|
+
if email is None:
|
|
190
|
+
raise AppwriteException('Missing required parameter: "email"')
|
|
191
|
+
|
|
192
|
+
if password is None:
|
|
193
|
+
raise AppwriteException('Missing required parameter: "password"')
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
api_params['userId'] = self._normalize_value(user_id)
|
|
197
|
+
api_params['email'] = self._normalize_value(email)
|
|
198
|
+
api_params['password'] = self._normalize_value(password)
|
|
199
|
+
if name is not None:
|
|
200
|
+
api_params['name'] = self._normalize_value(name)
|
|
201
|
+
|
|
202
|
+
response = self.client.call('post', api_path, {
|
|
203
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
204
|
+
'content-type': 'application/json',
|
|
205
|
+
'accept': 'application/json',
|
|
206
|
+
}, api_params)
|
|
207
|
+
|
|
208
|
+
return User.with_data(response, model_type)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def create_bcrypt_user(
|
|
212
|
+
self,
|
|
213
|
+
user_id: str,
|
|
214
|
+
email: str,
|
|
215
|
+
password: str,
|
|
216
|
+
name: Optional[str] = None,
|
|
217
|
+
model_type: Type[T] = dict
|
|
218
|
+
) -> User[T]:
|
|
219
|
+
"""
|
|
220
|
+
Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
221
|
+
|
|
222
|
+
Parameters
|
|
223
|
+
----------
|
|
224
|
+
user_id : str
|
|
225
|
+
User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
226
|
+
email : str
|
|
227
|
+
User email.
|
|
228
|
+
password : str
|
|
229
|
+
User password hashed using Bcrypt.
|
|
230
|
+
name : Optional[str]
|
|
231
|
+
User name. Max length: 128 chars.
|
|
232
|
+
|
|
233
|
+
model_type : Type[T], optional
|
|
234
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
235
|
+
|
|
236
|
+
Returns
|
|
237
|
+
-------
|
|
238
|
+
User[T]
|
|
239
|
+
API response as a typed Pydantic model
|
|
240
|
+
|
|
241
|
+
Raises
|
|
242
|
+
------
|
|
243
|
+
AppwriteException
|
|
244
|
+
If API request fails
|
|
245
|
+
"""
|
|
246
|
+
|
|
247
|
+
api_path = '/users/bcrypt'
|
|
248
|
+
api_params = {}
|
|
249
|
+
if user_id is None:
|
|
250
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
251
|
+
|
|
252
|
+
if email is None:
|
|
253
|
+
raise AppwriteException('Missing required parameter: "email"')
|
|
254
|
+
|
|
255
|
+
if password is None:
|
|
256
|
+
raise AppwriteException('Missing required parameter: "password"')
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
api_params['userId'] = self._normalize_value(user_id)
|
|
260
|
+
api_params['email'] = self._normalize_value(email)
|
|
261
|
+
api_params['password'] = self._normalize_value(password)
|
|
262
|
+
if name is not None:
|
|
263
|
+
api_params['name'] = self._normalize_value(name)
|
|
264
|
+
|
|
265
|
+
response = self.client.call('post', api_path, {
|
|
266
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
267
|
+
'content-type': 'application/json',
|
|
268
|
+
'accept': 'application/json',
|
|
269
|
+
}, api_params)
|
|
270
|
+
|
|
271
|
+
return User.with_data(response, model_type)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def list_identities(
|
|
275
|
+
self,
|
|
276
|
+
queries: Optional[List[str]] = None,
|
|
277
|
+
search: Optional[str] = None,
|
|
278
|
+
total: Optional[bool] = None
|
|
279
|
+
) -> IdentityList:
|
|
280
|
+
"""
|
|
281
|
+
Get identities for all users.
|
|
282
|
+
|
|
283
|
+
Parameters
|
|
284
|
+
----------
|
|
285
|
+
queries : Optional[List[str]]
|
|
286
|
+
Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
|
|
287
|
+
search : Optional[str]
|
|
288
|
+
Search term to filter your list results. Max length: 256 chars.
|
|
289
|
+
total : Optional[bool]
|
|
290
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
291
|
+
|
|
292
|
+
Returns
|
|
293
|
+
-------
|
|
294
|
+
IdentityList
|
|
295
|
+
API response as a typed Pydantic model
|
|
296
|
+
|
|
297
|
+
Raises
|
|
298
|
+
------
|
|
299
|
+
AppwriteException
|
|
300
|
+
If API request fails
|
|
301
|
+
"""
|
|
302
|
+
|
|
303
|
+
api_path = '/users/identities'
|
|
304
|
+
api_params = {}
|
|
305
|
+
|
|
306
|
+
if queries is not None:
|
|
307
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
308
|
+
if search is not None:
|
|
309
|
+
api_params['search'] = self._normalize_value(search)
|
|
310
|
+
if total is not None:
|
|
311
|
+
api_params['total'] = self._normalize_value(total)
|
|
312
|
+
|
|
313
|
+
response = self.client.call('get', api_path, {
|
|
314
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
315
|
+
'accept': 'application/json',
|
|
316
|
+
}, api_params)
|
|
317
|
+
|
|
318
|
+
return self._parse_response(response, model=IdentityList)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def delete_identity(
|
|
322
|
+
self,
|
|
323
|
+
identity_id: str
|
|
324
|
+
) -> Dict[str, Any]:
|
|
325
|
+
"""
|
|
326
|
+
Delete an identity by its unique ID.
|
|
327
|
+
|
|
328
|
+
Parameters
|
|
329
|
+
----------
|
|
330
|
+
identity_id : str
|
|
331
|
+
Identity ID.
|
|
332
|
+
|
|
333
|
+
Returns
|
|
334
|
+
-------
|
|
335
|
+
Dict[str, Any]
|
|
336
|
+
API response as a dictionary
|
|
337
|
+
|
|
338
|
+
Raises
|
|
339
|
+
------
|
|
340
|
+
AppwriteException
|
|
341
|
+
If API request fails
|
|
342
|
+
"""
|
|
343
|
+
|
|
344
|
+
api_path = '/users/identities/{identityId}'
|
|
345
|
+
api_params = {}
|
|
346
|
+
if identity_id is None:
|
|
347
|
+
raise AppwriteException('Missing required parameter: "identity_id"')
|
|
348
|
+
|
|
349
|
+
api_path = api_path.replace('{identityId}', str(self._normalize_value(identity_id)))
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
response = self.client.call('delete', api_path, {
|
|
353
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
354
|
+
'content-type': 'application/json',
|
|
355
|
+
}, api_params)
|
|
356
|
+
|
|
357
|
+
return response
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
def create_md5_user(
|
|
361
|
+
self,
|
|
362
|
+
user_id: str,
|
|
363
|
+
email: str,
|
|
364
|
+
password: str,
|
|
365
|
+
name: Optional[str] = None,
|
|
366
|
+
model_type: Type[T] = dict
|
|
367
|
+
) -> User[T]:
|
|
368
|
+
"""
|
|
369
|
+
Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
370
|
+
|
|
371
|
+
Parameters
|
|
372
|
+
----------
|
|
373
|
+
user_id : str
|
|
374
|
+
User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
375
|
+
email : str
|
|
376
|
+
User email.
|
|
377
|
+
password : str
|
|
378
|
+
User password hashed using MD5.
|
|
379
|
+
name : Optional[str]
|
|
380
|
+
User name. Max length: 128 chars.
|
|
381
|
+
|
|
382
|
+
model_type : Type[T], optional
|
|
383
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
384
|
+
|
|
385
|
+
Returns
|
|
386
|
+
-------
|
|
387
|
+
User[T]
|
|
388
|
+
API response as a typed Pydantic model
|
|
389
|
+
|
|
390
|
+
Raises
|
|
391
|
+
------
|
|
392
|
+
AppwriteException
|
|
393
|
+
If API request fails
|
|
394
|
+
"""
|
|
395
|
+
|
|
396
|
+
api_path = '/users/md5'
|
|
397
|
+
api_params = {}
|
|
398
|
+
if user_id is None:
|
|
399
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
400
|
+
|
|
401
|
+
if email is None:
|
|
402
|
+
raise AppwriteException('Missing required parameter: "email"')
|
|
403
|
+
|
|
404
|
+
if password is None:
|
|
405
|
+
raise AppwriteException('Missing required parameter: "password"')
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
api_params['userId'] = self._normalize_value(user_id)
|
|
409
|
+
api_params['email'] = self._normalize_value(email)
|
|
410
|
+
api_params['password'] = self._normalize_value(password)
|
|
411
|
+
if name is not None:
|
|
412
|
+
api_params['name'] = self._normalize_value(name)
|
|
413
|
+
|
|
414
|
+
response = self.client.call('post', api_path, {
|
|
415
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
416
|
+
'content-type': 'application/json',
|
|
417
|
+
'accept': 'application/json',
|
|
418
|
+
}, api_params)
|
|
419
|
+
|
|
420
|
+
return User.with_data(response, model_type)
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def create_ph_pass_user(
|
|
424
|
+
self,
|
|
425
|
+
user_id: str,
|
|
426
|
+
email: str,
|
|
427
|
+
password: str,
|
|
428
|
+
name: Optional[str] = None,
|
|
429
|
+
model_type: Type[T] = dict
|
|
430
|
+
) -> User[T]:
|
|
431
|
+
"""
|
|
432
|
+
Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
433
|
+
|
|
434
|
+
Parameters
|
|
435
|
+
----------
|
|
436
|
+
user_id : str
|
|
437
|
+
User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
438
|
+
email : str
|
|
439
|
+
User email.
|
|
440
|
+
password : str
|
|
441
|
+
User password hashed using PHPass.
|
|
442
|
+
name : Optional[str]
|
|
443
|
+
User name. Max length: 128 chars.
|
|
444
|
+
|
|
445
|
+
model_type : Type[T], optional
|
|
446
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
447
|
+
|
|
448
|
+
Returns
|
|
449
|
+
-------
|
|
450
|
+
User[T]
|
|
451
|
+
API response as a typed Pydantic model
|
|
452
|
+
|
|
453
|
+
Raises
|
|
454
|
+
------
|
|
455
|
+
AppwriteException
|
|
456
|
+
If API request fails
|
|
457
|
+
"""
|
|
458
|
+
|
|
459
|
+
api_path = '/users/phpass'
|
|
460
|
+
api_params = {}
|
|
461
|
+
if user_id is None:
|
|
462
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
463
|
+
|
|
464
|
+
if email is None:
|
|
465
|
+
raise AppwriteException('Missing required parameter: "email"')
|
|
466
|
+
|
|
467
|
+
if password is None:
|
|
468
|
+
raise AppwriteException('Missing required parameter: "password"')
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
api_params['userId'] = self._normalize_value(user_id)
|
|
472
|
+
api_params['email'] = self._normalize_value(email)
|
|
473
|
+
api_params['password'] = self._normalize_value(password)
|
|
474
|
+
if name is not None:
|
|
475
|
+
api_params['name'] = self._normalize_value(name)
|
|
476
|
+
|
|
477
|
+
response = self.client.call('post', api_path, {
|
|
478
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
479
|
+
'content-type': 'application/json',
|
|
480
|
+
'accept': 'application/json',
|
|
481
|
+
}, api_params)
|
|
482
|
+
|
|
483
|
+
return User.with_data(response, model_type)
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
def create_scrypt_user(
|
|
487
|
+
self,
|
|
488
|
+
user_id: str,
|
|
489
|
+
email: str,
|
|
490
|
+
password: str,
|
|
491
|
+
password_salt: str,
|
|
492
|
+
password_cpu: float,
|
|
493
|
+
password_memory: float,
|
|
494
|
+
password_parallel: float,
|
|
495
|
+
password_length: float,
|
|
496
|
+
name: Optional[str] = None,
|
|
497
|
+
model_type: Type[T] = dict
|
|
498
|
+
) -> User[T]:
|
|
499
|
+
"""
|
|
500
|
+
Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
501
|
+
|
|
502
|
+
Parameters
|
|
503
|
+
----------
|
|
504
|
+
user_id : str
|
|
505
|
+
User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
506
|
+
email : str
|
|
507
|
+
User email.
|
|
508
|
+
password : str
|
|
509
|
+
User password hashed using Scrypt.
|
|
510
|
+
password_salt : str
|
|
511
|
+
Optional salt used to hash password.
|
|
512
|
+
password_cpu : float
|
|
513
|
+
Optional CPU cost used to hash password.
|
|
514
|
+
password_memory : float
|
|
515
|
+
Optional memory cost used to hash password.
|
|
516
|
+
password_parallel : float
|
|
517
|
+
Optional parallelization cost used to hash password.
|
|
518
|
+
password_length : float
|
|
519
|
+
Optional hash length used to hash password.
|
|
520
|
+
name : Optional[str]
|
|
521
|
+
User name. Max length: 128 chars.
|
|
522
|
+
|
|
523
|
+
model_type : Type[T], optional
|
|
524
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
525
|
+
|
|
526
|
+
Returns
|
|
527
|
+
-------
|
|
528
|
+
User[T]
|
|
529
|
+
API response as a typed Pydantic model
|
|
530
|
+
|
|
531
|
+
Raises
|
|
532
|
+
------
|
|
533
|
+
AppwriteException
|
|
534
|
+
If API request fails
|
|
535
|
+
"""
|
|
536
|
+
|
|
537
|
+
api_path = '/users/scrypt'
|
|
538
|
+
api_params = {}
|
|
539
|
+
if user_id is None:
|
|
540
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
541
|
+
|
|
542
|
+
if email is None:
|
|
543
|
+
raise AppwriteException('Missing required parameter: "email"')
|
|
544
|
+
|
|
545
|
+
if password is None:
|
|
546
|
+
raise AppwriteException('Missing required parameter: "password"')
|
|
547
|
+
|
|
548
|
+
if password_salt is None:
|
|
549
|
+
raise AppwriteException('Missing required parameter: "password_salt"')
|
|
550
|
+
|
|
551
|
+
if password_cpu is None:
|
|
552
|
+
raise AppwriteException('Missing required parameter: "password_cpu"')
|
|
553
|
+
|
|
554
|
+
if password_memory is None:
|
|
555
|
+
raise AppwriteException('Missing required parameter: "password_memory"')
|
|
556
|
+
|
|
557
|
+
if password_parallel is None:
|
|
558
|
+
raise AppwriteException('Missing required parameter: "password_parallel"')
|
|
559
|
+
|
|
560
|
+
if password_length is None:
|
|
561
|
+
raise AppwriteException('Missing required parameter: "password_length"')
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
api_params['userId'] = self._normalize_value(user_id)
|
|
565
|
+
api_params['email'] = self._normalize_value(email)
|
|
566
|
+
api_params['password'] = self._normalize_value(password)
|
|
567
|
+
api_params['passwordSalt'] = self._normalize_value(password_salt)
|
|
568
|
+
api_params['passwordCpu'] = self._normalize_value(password_cpu)
|
|
569
|
+
api_params['passwordMemory'] = self._normalize_value(password_memory)
|
|
570
|
+
api_params['passwordParallel'] = self._normalize_value(password_parallel)
|
|
571
|
+
api_params['passwordLength'] = self._normalize_value(password_length)
|
|
572
|
+
if name is not None:
|
|
573
|
+
api_params['name'] = self._normalize_value(name)
|
|
574
|
+
|
|
575
|
+
response = self.client.call('post', api_path, {
|
|
576
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
577
|
+
'content-type': 'application/json',
|
|
578
|
+
'accept': 'application/json',
|
|
579
|
+
}, api_params)
|
|
580
|
+
|
|
581
|
+
return User.with_data(response, model_type)
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
def create_scrypt_modified_user(
|
|
585
|
+
self,
|
|
586
|
+
user_id: str,
|
|
587
|
+
email: str,
|
|
588
|
+
password: str,
|
|
589
|
+
password_salt: str,
|
|
590
|
+
password_salt_separator: str,
|
|
591
|
+
password_signer_key: str,
|
|
592
|
+
name: Optional[str] = None,
|
|
593
|
+
model_type: Type[T] = dict
|
|
594
|
+
) -> User[T]:
|
|
595
|
+
"""
|
|
596
|
+
Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
597
|
+
|
|
598
|
+
Parameters
|
|
599
|
+
----------
|
|
600
|
+
user_id : str
|
|
601
|
+
User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
602
|
+
email : str
|
|
603
|
+
User email.
|
|
604
|
+
password : str
|
|
605
|
+
User password hashed using Scrypt Modified.
|
|
606
|
+
password_salt : str
|
|
607
|
+
Salt used to hash password.
|
|
608
|
+
password_salt_separator : str
|
|
609
|
+
Salt separator used to hash password.
|
|
610
|
+
password_signer_key : str
|
|
611
|
+
Signer key used to hash password.
|
|
612
|
+
name : Optional[str]
|
|
613
|
+
User name. Max length: 128 chars.
|
|
614
|
+
|
|
615
|
+
model_type : Type[T], optional
|
|
616
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
617
|
+
|
|
618
|
+
Returns
|
|
619
|
+
-------
|
|
620
|
+
User[T]
|
|
621
|
+
API response as a typed Pydantic model
|
|
622
|
+
|
|
623
|
+
Raises
|
|
624
|
+
------
|
|
625
|
+
AppwriteException
|
|
626
|
+
If API request fails
|
|
627
|
+
"""
|
|
628
|
+
|
|
629
|
+
api_path = '/users/scrypt-modified'
|
|
630
|
+
api_params = {}
|
|
631
|
+
if user_id is None:
|
|
632
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
633
|
+
|
|
634
|
+
if email is None:
|
|
635
|
+
raise AppwriteException('Missing required parameter: "email"')
|
|
636
|
+
|
|
637
|
+
if password is None:
|
|
638
|
+
raise AppwriteException('Missing required parameter: "password"')
|
|
639
|
+
|
|
640
|
+
if password_salt is None:
|
|
641
|
+
raise AppwriteException('Missing required parameter: "password_salt"')
|
|
642
|
+
|
|
643
|
+
if password_salt_separator is None:
|
|
644
|
+
raise AppwriteException('Missing required parameter: "password_salt_separator"')
|
|
645
|
+
|
|
646
|
+
if password_signer_key is None:
|
|
647
|
+
raise AppwriteException('Missing required parameter: "password_signer_key"')
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
api_params['userId'] = self._normalize_value(user_id)
|
|
651
|
+
api_params['email'] = self._normalize_value(email)
|
|
652
|
+
api_params['password'] = self._normalize_value(password)
|
|
653
|
+
api_params['passwordSalt'] = self._normalize_value(password_salt)
|
|
654
|
+
api_params['passwordSaltSeparator'] = self._normalize_value(password_salt_separator)
|
|
655
|
+
api_params['passwordSignerKey'] = self._normalize_value(password_signer_key)
|
|
656
|
+
if name is not None:
|
|
657
|
+
api_params['name'] = self._normalize_value(name)
|
|
658
|
+
|
|
659
|
+
response = self.client.call('post', api_path, {
|
|
660
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
661
|
+
'content-type': 'application/json',
|
|
662
|
+
'accept': 'application/json',
|
|
663
|
+
}, api_params)
|
|
664
|
+
|
|
665
|
+
return User.with_data(response, model_type)
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
def create_sha_user(
|
|
669
|
+
self,
|
|
670
|
+
user_id: str,
|
|
671
|
+
email: str,
|
|
672
|
+
password: str,
|
|
673
|
+
password_version: Optional[PasswordHash] = None,
|
|
674
|
+
name: Optional[str] = None,
|
|
675
|
+
model_type: Type[T] = dict
|
|
676
|
+
) -> User[T]:
|
|
677
|
+
"""
|
|
678
|
+
Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
|
|
679
|
+
|
|
680
|
+
Parameters
|
|
681
|
+
----------
|
|
682
|
+
user_id : str
|
|
683
|
+
User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
684
|
+
email : str
|
|
685
|
+
User email.
|
|
686
|
+
password : str
|
|
687
|
+
User password hashed using SHA.
|
|
688
|
+
password_version : Optional[PasswordHash]
|
|
689
|
+
Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
|
|
690
|
+
name : Optional[str]
|
|
691
|
+
User name. Max length: 128 chars.
|
|
692
|
+
|
|
693
|
+
model_type : Type[T], optional
|
|
694
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
695
|
+
|
|
696
|
+
Returns
|
|
697
|
+
-------
|
|
698
|
+
User[T]
|
|
699
|
+
API response as a typed Pydantic model
|
|
700
|
+
|
|
701
|
+
Raises
|
|
702
|
+
------
|
|
703
|
+
AppwriteException
|
|
704
|
+
If API request fails
|
|
705
|
+
"""
|
|
706
|
+
|
|
707
|
+
api_path = '/users/sha'
|
|
708
|
+
api_params = {}
|
|
709
|
+
if user_id is None:
|
|
710
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
711
|
+
|
|
712
|
+
if email is None:
|
|
713
|
+
raise AppwriteException('Missing required parameter: "email"')
|
|
714
|
+
|
|
715
|
+
if password is None:
|
|
716
|
+
raise AppwriteException('Missing required parameter: "password"')
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
api_params['userId'] = self._normalize_value(user_id)
|
|
720
|
+
api_params['email'] = self._normalize_value(email)
|
|
721
|
+
api_params['password'] = self._normalize_value(password)
|
|
722
|
+
if password_version is not None:
|
|
723
|
+
api_params['passwordVersion'] = self._normalize_value(password_version)
|
|
724
|
+
if name is not None:
|
|
725
|
+
api_params['name'] = self._normalize_value(name)
|
|
726
|
+
|
|
727
|
+
response = self.client.call('post', api_path, {
|
|
728
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
729
|
+
'content-type': 'application/json',
|
|
730
|
+
'accept': 'application/json',
|
|
731
|
+
}, api_params)
|
|
732
|
+
|
|
733
|
+
return User.with_data(response, model_type)
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
def get_usage(
|
|
737
|
+
self,
|
|
738
|
+
range: Optional[UsageRange] = None
|
|
739
|
+
) -> UsageUsers:
|
|
740
|
+
"""
|
|
741
|
+
Get usage metrics and statistics for all users in the project. You can view the total number of users and sessions. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
Parameters
|
|
745
|
+
----------
|
|
746
|
+
range : Optional[UsageRange]
|
|
747
|
+
Date range.
|
|
748
|
+
|
|
749
|
+
Returns
|
|
750
|
+
-------
|
|
751
|
+
UsageUsers
|
|
752
|
+
API response as a typed Pydantic model
|
|
753
|
+
|
|
754
|
+
Raises
|
|
755
|
+
------
|
|
756
|
+
AppwriteException
|
|
757
|
+
If API request fails
|
|
758
|
+
"""
|
|
759
|
+
|
|
760
|
+
api_path = '/users/usage'
|
|
761
|
+
api_params = {}
|
|
762
|
+
|
|
763
|
+
if range is not None:
|
|
764
|
+
api_params['range'] = self._normalize_value(range)
|
|
765
|
+
|
|
766
|
+
response = self.client.call('get', api_path, {
|
|
767
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
768
|
+
'accept': 'application/json',
|
|
769
|
+
}, api_params)
|
|
770
|
+
|
|
771
|
+
return self._parse_response(response, model=UsageUsers)
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
def get(
|
|
775
|
+
self,
|
|
776
|
+
user_id: str,
|
|
777
|
+
model_type: Type[T] = dict
|
|
778
|
+
) -> User[T]:
|
|
779
|
+
"""
|
|
780
|
+
Get a user by its unique ID.
|
|
781
|
+
|
|
782
|
+
Parameters
|
|
783
|
+
----------
|
|
784
|
+
user_id : str
|
|
785
|
+
User ID.
|
|
786
|
+
|
|
787
|
+
model_type : Type[T], optional
|
|
788
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
789
|
+
|
|
790
|
+
Returns
|
|
791
|
+
-------
|
|
792
|
+
User[T]
|
|
793
|
+
API response as a typed Pydantic model
|
|
794
|
+
|
|
795
|
+
Raises
|
|
796
|
+
------
|
|
797
|
+
AppwriteException
|
|
798
|
+
If API request fails
|
|
799
|
+
"""
|
|
800
|
+
|
|
801
|
+
api_path = '/users/{userId}'
|
|
802
|
+
api_params = {}
|
|
803
|
+
if user_id is None:
|
|
804
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
805
|
+
|
|
806
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
response = self.client.call('get', api_path, {
|
|
810
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
811
|
+
'accept': 'application/json',
|
|
812
|
+
}, api_params)
|
|
813
|
+
|
|
814
|
+
return User.with_data(response, model_type)
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
def delete(
|
|
818
|
+
self,
|
|
819
|
+
user_id: str
|
|
820
|
+
) -> Dict[str, Any]:
|
|
821
|
+
"""
|
|
822
|
+
Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead.
|
|
823
|
+
|
|
824
|
+
Parameters
|
|
825
|
+
----------
|
|
826
|
+
user_id : str
|
|
827
|
+
User ID.
|
|
828
|
+
|
|
829
|
+
Returns
|
|
830
|
+
-------
|
|
831
|
+
Dict[str, Any]
|
|
832
|
+
API response as a dictionary
|
|
833
|
+
|
|
834
|
+
Raises
|
|
835
|
+
------
|
|
836
|
+
AppwriteException
|
|
837
|
+
If API request fails
|
|
838
|
+
"""
|
|
839
|
+
|
|
840
|
+
api_path = '/users/{userId}'
|
|
841
|
+
api_params = {}
|
|
842
|
+
if user_id is None:
|
|
843
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
844
|
+
|
|
845
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
response = self.client.call('delete', api_path, {
|
|
849
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
850
|
+
'content-type': 'application/json',
|
|
851
|
+
}, api_params)
|
|
852
|
+
|
|
853
|
+
return response
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
def update_email(
|
|
857
|
+
self,
|
|
858
|
+
user_id: str,
|
|
859
|
+
email: str,
|
|
860
|
+
model_type: Type[T] = dict
|
|
861
|
+
) -> User[T]:
|
|
862
|
+
"""
|
|
863
|
+
Update the user email by its unique ID.
|
|
864
|
+
|
|
865
|
+
Parameters
|
|
866
|
+
----------
|
|
867
|
+
user_id : str
|
|
868
|
+
User ID.
|
|
869
|
+
email : str
|
|
870
|
+
User email.
|
|
871
|
+
|
|
872
|
+
model_type : Type[T], optional
|
|
873
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
874
|
+
|
|
875
|
+
Returns
|
|
876
|
+
-------
|
|
877
|
+
User[T]
|
|
878
|
+
API response as a typed Pydantic model
|
|
879
|
+
|
|
880
|
+
Raises
|
|
881
|
+
------
|
|
882
|
+
AppwriteException
|
|
883
|
+
If API request fails
|
|
884
|
+
"""
|
|
885
|
+
|
|
886
|
+
api_path = '/users/{userId}/email'
|
|
887
|
+
api_params = {}
|
|
888
|
+
if user_id is None:
|
|
889
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
890
|
+
|
|
891
|
+
if email is None:
|
|
892
|
+
raise AppwriteException('Missing required parameter: "email"')
|
|
893
|
+
|
|
894
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
895
|
+
|
|
896
|
+
api_params['email'] = self._normalize_value(email)
|
|
897
|
+
|
|
898
|
+
response = self.client.call('patch', api_path, {
|
|
899
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
900
|
+
'content-type': 'application/json',
|
|
901
|
+
'accept': 'application/json',
|
|
902
|
+
}, api_params)
|
|
903
|
+
|
|
904
|
+
return User.with_data(response, model_type)
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
def update_impersonator(
|
|
908
|
+
self,
|
|
909
|
+
user_id: str,
|
|
910
|
+
impersonator: bool,
|
|
911
|
+
model_type: Type[T] = dict
|
|
912
|
+
) -> User[T]:
|
|
913
|
+
"""
|
|
914
|
+
Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data.
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
Parameters
|
|
918
|
+
----------
|
|
919
|
+
user_id : str
|
|
920
|
+
User ID.
|
|
921
|
+
impersonator : bool
|
|
922
|
+
Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data.
|
|
923
|
+
|
|
924
|
+
model_type : Type[T], optional
|
|
925
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
926
|
+
|
|
927
|
+
Returns
|
|
928
|
+
-------
|
|
929
|
+
User[T]
|
|
930
|
+
API response as a typed Pydantic model
|
|
931
|
+
|
|
932
|
+
Raises
|
|
933
|
+
------
|
|
934
|
+
AppwriteException
|
|
935
|
+
If API request fails
|
|
936
|
+
"""
|
|
937
|
+
|
|
938
|
+
api_path = '/users/{userId}/impersonator'
|
|
939
|
+
api_params = {}
|
|
940
|
+
if user_id is None:
|
|
941
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
942
|
+
|
|
943
|
+
if impersonator is None:
|
|
944
|
+
raise AppwriteException('Missing required parameter: "impersonator"')
|
|
945
|
+
|
|
946
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
947
|
+
|
|
948
|
+
api_params['impersonator'] = self._normalize_value(impersonator)
|
|
949
|
+
|
|
950
|
+
response = self.client.call('patch', api_path, {
|
|
951
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
952
|
+
'content-type': 'application/json',
|
|
953
|
+
'accept': 'application/json',
|
|
954
|
+
}, api_params)
|
|
955
|
+
|
|
956
|
+
return User.with_data(response, model_type)
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
def create_jwt(
|
|
960
|
+
self,
|
|
961
|
+
user_id: str,
|
|
962
|
+
session_id: Optional[str] = None,
|
|
963
|
+
duration: Optional[float] = None
|
|
964
|
+
) -> Jwt:
|
|
965
|
+
"""
|
|
966
|
+
Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.
|
|
967
|
+
|
|
968
|
+
Parameters
|
|
969
|
+
----------
|
|
970
|
+
user_id : str
|
|
971
|
+
User ID.
|
|
972
|
+
session_id : Optional[str]
|
|
973
|
+
Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session.
|
|
974
|
+
duration : Optional[float]
|
|
975
|
+
Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
|
|
976
|
+
|
|
977
|
+
Returns
|
|
978
|
+
-------
|
|
979
|
+
Jwt
|
|
980
|
+
API response as a typed Pydantic model
|
|
981
|
+
|
|
982
|
+
Raises
|
|
983
|
+
------
|
|
984
|
+
AppwriteException
|
|
985
|
+
If API request fails
|
|
986
|
+
"""
|
|
987
|
+
|
|
988
|
+
api_path = '/users/{userId}/jwts'
|
|
989
|
+
api_params = {}
|
|
990
|
+
if user_id is None:
|
|
991
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
992
|
+
|
|
993
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
994
|
+
|
|
995
|
+
if session_id is not None:
|
|
996
|
+
api_params['sessionId'] = self._normalize_value(session_id)
|
|
997
|
+
if duration is not None:
|
|
998
|
+
api_params['duration'] = self._normalize_value(duration)
|
|
999
|
+
|
|
1000
|
+
response = self.client.call('post', api_path, {
|
|
1001
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1002
|
+
'content-type': 'application/json',
|
|
1003
|
+
'accept': 'application/json',
|
|
1004
|
+
}, api_params)
|
|
1005
|
+
|
|
1006
|
+
return self._parse_response(response, model=Jwt)
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
def update_labels(
|
|
1010
|
+
self,
|
|
1011
|
+
user_id: str,
|
|
1012
|
+
labels: List[str],
|
|
1013
|
+
model_type: Type[T] = dict
|
|
1014
|
+
) -> User[T]:
|
|
1015
|
+
"""
|
|
1016
|
+
Update the user labels by its unique ID.
|
|
1017
|
+
|
|
1018
|
+
Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info.
|
|
1019
|
+
|
|
1020
|
+
Parameters
|
|
1021
|
+
----------
|
|
1022
|
+
user_id : str
|
|
1023
|
+
User ID.
|
|
1024
|
+
labels : List[str]
|
|
1025
|
+
Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.
|
|
1026
|
+
|
|
1027
|
+
model_type : Type[T], optional
|
|
1028
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1029
|
+
|
|
1030
|
+
Returns
|
|
1031
|
+
-------
|
|
1032
|
+
User[T]
|
|
1033
|
+
API response as a typed Pydantic model
|
|
1034
|
+
|
|
1035
|
+
Raises
|
|
1036
|
+
------
|
|
1037
|
+
AppwriteException
|
|
1038
|
+
If API request fails
|
|
1039
|
+
"""
|
|
1040
|
+
|
|
1041
|
+
api_path = '/users/{userId}/labels'
|
|
1042
|
+
api_params = {}
|
|
1043
|
+
if user_id is None:
|
|
1044
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1045
|
+
|
|
1046
|
+
if labels is None:
|
|
1047
|
+
raise AppwriteException('Missing required parameter: "labels"')
|
|
1048
|
+
|
|
1049
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1050
|
+
|
|
1051
|
+
api_params['labels'] = self._normalize_value(labels)
|
|
1052
|
+
|
|
1053
|
+
response = self.client.call('put', api_path, {
|
|
1054
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1055
|
+
'content-type': 'application/json',
|
|
1056
|
+
'accept': 'application/json',
|
|
1057
|
+
}, api_params)
|
|
1058
|
+
|
|
1059
|
+
return User.with_data(response, model_type)
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
def list_logs(
|
|
1063
|
+
self,
|
|
1064
|
+
user_id: str,
|
|
1065
|
+
queries: Optional[List[str]] = None,
|
|
1066
|
+
total: Optional[bool] = None
|
|
1067
|
+
) -> LogList:
|
|
1068
|
+
"""
|
|
1069
|
+
Get the user activity logs list by its unique ID.
|
|
1070
|
+
|
|
1071
|
+
Parameters
|
|
1072
|
+
----------
|
|
1073
|
+
user_id : str
|
|
1074
|
+
User ID.
|
|
1075
|
+
queries : Optional[List[str]]
|
|
1076
|
+
Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
|
|
1077
|
+
total : Optional[bool]
|
|
1078
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
1079
|
+
|
|
1080
|
+
Returns
|
|
1081
|
+
-------
|
|
1082
|
+
LogList
|
|
1083
|
+
API response as a typed Pydantic model
|
|
1084
|
+
|
|
1085
|
+
Raises
|
|
1086
|
+
------
|
|
1087
|
+
AppwriteException
|
|
1088
|
+
If API request fails
|
|
1089
|
+
"""
|
|
1090
|
+
|
|
1091
|
+
api_path = '/users/{userId}/logs'
|
|
1092
|
+
api_params = {}
|
|
1093
|
+
if user_id is None:
|
|
1094
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1095
|
+
|
|
1096
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1097
|
+
|
|
1098
|
+
if queries is not None:
|
|
1099
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
1100
|
+
if total is not None:
|
|
1101
|
+
api_params['total'] = self._normalize_value(total)
|
|
1102
|
+
|
|
1103
|
+
response = self.client.call('get', api_path, {
|
|
1104
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1105
|
+
'accept': 'application/json',
|
|
1106
|
+
}, api_params)
|
|
1107
|
+
|
|
1108
|
+
return self._parse_response(response, model=LogList)
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
def list_memberships(
|
|
1112
|
+
self,
|
|
1113
|
+
user_id: str,
|
|
1114
|
+
queries: Optional[List[str]] = None,
|
|
1115
|
+
search: Optional[str] = None,
|
|
1116
|
+
total: Optional[bool] = None
|
|
1117
|
+
) -> MembershipList:
|
|
1118
|
+
"""
|
|
1119
|
+
Get the user membership list by its unique ID.
|
|
1120
|
+
|
|
1121
|
+
Parameters
|
|
1122
|
+
----------
|
|
1123
|
+
user_id : str
|
|
1124
|
+
User ID.
|
|
1125
|
+
queries : Optional[List[str]]
|
|
1126
|
+
Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles
|
|
1127
|
+
search : Optional[str]
|
|
1128
|
+
Search term to filter your list results. Max length: 256 chars.
|
|
1129
|
+
total : Optional[bool]
|
|
1130
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
1131
|
+
|
|
1132
|
+
Returns
|
|
1133
|
+
-------
|
|
1134
|
+
MembershipList
|
|
1135
|
+
API response as a typed Pydantic model
|
|
1136
|
+
|
|
1137
|
+
Raises
|
|
1138
|
+
------
|
|
1139
|
+
AppwriteException
|
|
1140
|
+
If API request fails
|
|
1141
|
+
"""
|
|
1142
|
+
|
|
1143
|
+
api_path = '/users/{userId}/memberships'
|
|
1144
|
+
api_params = {}
|
|
1145
|
+
if user_id is None:
|
|
1146
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1147
|
+
|
|
1148
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1149
|
+
|
|
1150
|
+
if queries is not None:
|
|
1151
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
1152
|
+
if search is not None:
|
|
1153
|
+
api_params['search'] = self._normalize_value(search)
|
|
1154
|
+
if total is not None:
|
|
1155
|
+
api_params['total'] = self._normalize_value(total)
|
|
1156
|
+
|
|
1157
|
+
response = self.client.call('get', api_path, {
|
|
1158
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1159
|
+
'accept': 'application/json',
|
|
1160
|
+
}, api_params)
|
|
1161
|
+
|
|
1162
|
+
return self._parse_response(response, model=MembershipList)
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
def update_mfa(
|
|
1166
|
+
self,
|
|
1167
|
+
user_id: str,
|
|
1168
|
+
mfa: bool,
|
|
1169
|
+
model_type: Type[T] = dict
|
|
1170
|
+
) -> User[T]:
|
|
1171
|
+
"""
|
|
1172
|
+
Enable or disable MFA on a user account.
|
|
1173
|
+
|
|
1174
|
+
Parameters
|
|
1175
|
+
----------
|
|
1176
|
+
user_id : str
|
|
1177
|
+
User ID.
|
|
1178
|
+
mfa : bool
|
|
1179
|
+
Enable or disable MFA.
|
|
1180
|
+
|
|
1181
|
+
model_type : Type[T], optional
|
|
1182
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1183
|
+
|
|
1184
|
+
Returns
|
|
1185
|
+
-------
|
|
1186
|
+
User[T]
|
|
1187
|
+
API response as a typed Pydantic model
|
|
1188
|
+
|
|
1189
|
+
Raises
|
|
1190
|
+
------
|
|
1191
|
+
AppwriteException
|
|
1192
|
+
If API request fails
|
|
1193
|
+
"""
|
|
1194
|
+
|
|
1195
|
+
api_path = '/users/{userId}/mfa'
|
|
1196
|
+
api_params = {}
|
|
1197
|
+
if user_id is None:
|
|
1198
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1199
|
+
|
|
1200
|
+
if mfa is None:
|
|
1201
|
+
raise AppwriteException('Missing required parameter: "mfa"')
|
|
1202
|
+
|
|
1203
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1204
|
+
|
|
1205
|
+
api_params['mfa'] = self._normalize_value(mfa)
|
|
1206
|
+
|
|
1207
|
+
response = self.client.call('patch', api_path, {
|
|
1208
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1209
|
+
'content-type': 'application/json',
|
|
1210
|
+
'accept': 'application/json',
|
|
1211
|
+
}, api_params)
|
|
1212
|
+
|
|
1213
|
+
return User.with_data(response, model_type)
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
def delete_mfa_authenticator(
|
|
1217
|
+
self,
|
|
1218
|
+
user_id: str,
|
|
1219
|
+
type: AuthenticatorType
|
|
1220
|
+
) -> Dict[str, Any]:
|
|
1221
|
+
"""
|
|
1222
|
+
Delete an authenticator app.
|
|
1223
|
+
|
|
1224
|
+
Parameters
|
|
1225
|
+
----------
|
|
1226
|
+
user_id : str
|
|
1227
|
+
User ID.
|
|
1228
|
+
type : AuthenticatorType
|
|
1229
|
+
Type of authenticator.
|
|
1230
|
+
|
|
1231
|
+
Returns
|
|
1232
|
+
-------
|
|
1233
|
+
Dict[str, Any]
|
|
1234
|
+
API response as a dictionary
|
|
1235
|
+
|
|
1236
|
+
Raises
|
|
1237
|
+
------
|
|
1238
|
+
AppwriteException
|
|
1239
|
+
If API request fails
|
|
1240
|
+
"""
|
|
1241
|
+
|
|
1242
|
+
api_path = '/users/{userId}/mfa/authenticators/{type}'
|
|
1243
|
+
api_params = {}
|
|
1244
|
+
if user_id is None:
|
|
1245
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1246
|
+
|
|
1247
|
+
if type is None:
|
|
1248
|
+
raise AppwriteException('Missing required parameter: "type"')
|
|
1249
|
+
|
|
1250
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1251
|
+
api_path = api_path.replace('{type}', str(self._normalize_value(type)))
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
response = self.client.call('delete', api_path, {
|
|
1255
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1256
|
+
'content-type': 'application/json',
|
|
1257
|
+
}, api_params)
|
|
1258
|
+
|
|
1259
|
+
return response
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
def list_mfa_factors(
|
|
1263
|
+
self,
|
|
1264
|
+
user_id: str
|
|
1265
|
+
) -> MfaFactors:
|
|
1266
|
+
"""
|
|
1267
|
+
List the factors available on the account to be used as a MFA challange.
|
|
1268
|
+
|
|
1269
|
+
Parameters
|
|
1270
|
+
----------
|
|
1271
|
+
user_id : str
|
|
1272
|
+
User ID.
|
|
1273
|
+
|
|
1274
|
+
Returns
|
|
1275
|
+
-------
|
|
1276
|
+
MfaFactors
|
|
1277
|
+
API response as a typed Pydantic model
|
|
1278
|
+
|
|
1279
|
+
Raises
|
|
1280
|
+
------
|
|
1281
|
+
AppwriteException
|
|
1282
|
+
If API request fails
|
|
1283
|
+
"""
|
|
1284
|
+
|
|
1285
|
+
api_path = '/users/{userId}/mfa/factors'
|
|
1286
|
+
api_params = {}
|
|
1287
|
+
if user_id is None:
|
|
1288
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1289
|
+
|
|
1290
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
response = self.client.call('get', api_path, {
|
|
1294
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1295
|
+
'accept': 'application/json',
|
|
1296
|
+
}, api_params)
|
|
1297
|
+
|
|
1298
|
+
return self._parse_response(response, model=MfaFactors)
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
def get_mfa_recovery_codes(
|
|
1302
|
+
self,
|
|
1303
|
+
user_id: str
|
|
1304
|
+
) -> MfaRecoveryCodes:
|
|
1305
|
+
"""
|
|
1306
|
+
Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.
|
|
1307
|
+
|
|
1308
|
+
Parameters
|
|
1309
|
+
----------
|
|
1310
|
+
user_id : str
|
|
1311
|
+
User ID.
|
|
1312
|
+
|
|
1313
|
+
Returns
|
|
1314
|
+
-------
|
|
1315
|
+
MfaRecoveryCodes
|
|
1316
|
+
API response as a typed Pydantic model
|
|
1317
|
+
|
|
1318
|
+
Raises
|
|
1319
|
+
------
|
|
1320
|
+
AppwriteException
|
|
1321
|
+
If API request fails
|
|
1322
|
+
"""
|
|
1323
|
+
|
|
1324
|
+
api_path = '/users/{userId}/mfa/recovery-codes'
|
|
1325
|
+
api_params = {}
|
|
1326
|
+
if user_id is None:
|
|
1327
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1328
|
+
|
|
1329
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
response = self.client.call('get', api_path, {
|
|
1333
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1334
|
+
'accept': 'application/json',
|
|
1335
|
+
}, api_params)
|
|
1336
|
+
|
|
1337
|
+
return self._parse_response(response, model=MfaRecoveryCodes)
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
def update_mfa_recovery_codes(
|
|
1341
|
+
self,
|
|
1342
|
+
user_id: str
|
|
1343
|
+
) -> MfaRecoveryCodes:
|
|
1344
|
+
"""
|
|
1345
|
+
Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.
|
|
1346
|
+
|
|
1347
|
+
Parameters
|
|
1348
|
+
----------
|
|
1349
|
+
user_id : str
|
|
1350
|
+
User ID.
|
|
1351
|
+
|
|
1352
|
+
Returns
|
|
1353
|
+
-------
|
|
1354
|
+
MfaRecoveryCodes
|
|
1355
|
+
API response as a typed Pydantic model
|
|
1356
|
+
|
|
1357
|
+
Raises
|
|
1358
|
+
------
|
|
1359
|
+
AppwriteException
|
|
1360
|
+
If API request fails
|
|
1361
|
+
"""
|
|
1362
|
+
|
|
1363
|
+
api_path = '/users/{userId}/mfa/recovery-codes'
|
|
1364
|
+
api_params = {}
|
|
1365
|
+
if user_id is None:
|
|
1366
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1367
|
+
|
|
1368
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
response = self.client.call('put', api_path, {
|
|
1372
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1373
|
+
'content-type': 'application/json',
|
|
1374
|
+
'accept': 'application/json',
|
|
1375
|
+
}, api_params)
|
|
1376
|
+
|
|
1377
|
+
return self._parse_response(response, model=MfaRecoveryCodes)
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
def create_mfa_recovery_codes(
|
|
1381
|
+
self,
|
|
1382
|
+
user_id: str
|
|
1383
|
+
) -> MfaRecoveryCodes:
|
|
1384
|
+
"""
|
|
1385
|
+
Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK.
|
|
1386
|
+
|
|
1387
|
+
Parameters
|
|
1388
|
+
----------
|
|
1389
|
+
user_id : str
|
|
1390
|
+
User ID.
|
|
1391
|
+
|
|
1392
|
+
Returns
|
|
1393
|
+
-------
|
|
1394
|
+
MfaRecoveryCodes
|
|
1395
|
+
API response as a typed Pydantic model
|
|
1396
|
+
|
|
1397
|
+
Raises
|
|
1398
|
+
------
|
|
1399
|
+
AppwriteException
|
|
1400
|
+
If API request fails
|
|
1401
|
+
"""
|
|
1402
|
+
|
|
1403
|
+
api_path = '/users/{userId}/mfa/recovery-codes'
|
|
1404
|
+
api_params = {}
|
|
1405
|
+
if user_id is None:
|
|
1406
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1407
|
+
|
|
1408
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
response = self.client.call('patch', api_path, {
|
|
1412
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1413
|
+
'content-type': 'application/json',
|
|
1414
|
+
'accept': 'application/json',
|
|
1415
|
+
}, api_params)
|
|
1416
|
+
|
|
1417
|
+
return self._parse_response(response, model=MfaRecoveryCodes)
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
def update_name(
|
|
1421
|
+
self,
|
|
1422
|
+
user_id: str,
|
|
1423
|
+
name: str,
|
|
1424
|
+
model_type: Type[T] = dict
|
|
1425
|
+
) -> User[T]:
|
|
1426
|
+
"""
|
|
1427
|
+
Update the user name by its unique ID.
|
|
1428
|
+
|
|
1429
|
+
Parameters
|
|
1430
|
+
----------
|
|
1431
|
+
user_id : str
|
|
1432
|
+
User ID.
|
|
1433
|
+
name : str
|
|
1434
|
+
User name. Max length: 128 chars.
|
|
1435
|
+
|
|
1436
|
+
model_type : Type[T], optional
|
|
1437
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1438
|
+
|
|
1439
|
+
Returns
|
|
1440
|
+
-------
|
|
1441
|
+
User[T]
|
|
1442
|
+
API response as a typed Pydantic model
|
|
1443
|
+
|
|
1444
|
+
Raises
|
|
1445
|
+
------
|
|
1446
|
+
AppwriteException
|
|
1447
|
+
If API request fails
|
|
1448
|
+
"""
|
|
1449
|
+
|
|
1450
|
+
api_path = '/users/{userId}/name'
|
|
1451
|
+
api_params = {}
|
|
1452
|
+
if user_id is None:
|
|
1453
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1454
|
+
|
|
1455
|
+
if name is None:
|
|
1456
|
+
raise AppwriteException('Missing required parameter: "name"')
|
|
1457
|
+
|
|
1458
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1459
|
+
|
|
1460
|
+
api_params['name'] = self._normalize_value(name)
|
|
1461
|
+
|
|
1462
|
+
response = self.client.call('patch', api_path, {
|
|
1463
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1464
|
+
'content-type': 'application/json',
|
|
1465
|
+
'accept': 'application/json',
|
|
1466
|
+
}, api_params)
|
|
1467
|
+
|
|
1468
|
+
return User.with_data(response, model_type)
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
def update_password(
|
|
1472
|
+
self,
|
|
1473
|
+
user_id: str,
|
|
1474
|
+
password: str,
|
|
1475
|
+
model_type: Type[T] = dict
|
|
1476
|
+
) -> User[T]:
|
|
1477
|
+
"""
|
|
1478
|
+
Update the user password by its unique ID.
|
|
1479
|
+
|
|
1480
|
+
Parameters
|
|
1481
|
+
----------
|
|
1482
|
+
user_id : str
|
|
1483
|
+
User ID.
|
|
1484
|
+
password : str
|
|
1485
|
+
New user password. Must be at least 8 chars.
|
|
1486
|
+
|
|
1487
|
+
model_type : Type[T], optional
|
|
1488
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1489
|
+
|
|
1490
|
+
Returns
|
|
1491
|
+
-------
|
|
1492
|
+
User[T]
|
|
1493
|
+
API response as a typed Pydantic model
|
|
1494
|
+
|
|
1495
|
+
Raises
|
|
1496
|
+
------
|
|
1497
|
+
AppwriteException
|
|
1498
|
+
If API request fails
|
|
1499
|
+
"""
|
|
1500
|
+
|
|
1501
|
+
api_path = '/users/{userId}/password'
|
|
1502
|
+
api_params = {}
|
|
1503
|
+
if user_id is None:
|
|
1504
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1505
|
+
|
|
1506
|
+
if password is None:
|
|
1507
|
+
raise AppwriteException('Missing required parameter: "password"')
|
|
1508
|
+
|
|
1509
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1510
|
+
|
|
1511
|
+
api_params['password'] = self._normalize_value(password)
|
|
1512
|
+
|
|
1513
|
+
response = self.client.call('patch', api_path, {
|
|
1514
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1515
|
+
'content-type': 'application/json',
|
|
1516
|
+
'accept': 'application/json',
|
|
1517
|
+
}, api_params)
|
|
1518
|
+
|
|
1519
|
+
return User.with_data(response, model_type)
|
|
1520
|
+
|
|
1521
|
+
|
|
1522
|
+
def update_phone(
|
|
1523
|
+
self,
|
|
1524
|
+
user_id: str,
|
|
1525
|
+
number: str,
|
|
1526
|
+
model_type: Type[T] = dict
|
|
1527
|
+
) -> User[T]:
|
|
1528
|
+
"""
|
|
1529
|
+
Update the user phone by its unique ID.
|
|
1530
|
+
|
|
1531
|
+
Parameters
|
|
1532
|
+
----------
|
|
1533
|
+
user_id : str
|
|
1534
|
+
User ID.
|
|
1535
|
+
number : str
|
|
1536
|
+
User phone number.
|
|
1537
|
+
|
|
1538
|
+
model_type : Type[T], optional
|
|
1539
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1540
|
+
|
|
1541
|
+
Returns
|
|
1542
|
+
-------
|
|
1543
|
+
User[T]
|
|
1544
|
+
API response as a typed Pydantic model
|
|
1545
|
+
|
|
1546
|
+
Raises
|
|
1547
|
+
------
|
|
1548
|
+
AppwriteException
|
|
1549
|
+
If API request fails
|
|
1550
|
+
"""
|
|
1551
|
+
|
|
1552
|
+
api_path = '/users/{userId}/phone'
|
|
1553
|
+
api_params = {}
|
|
1554
|
+
if user_id is None:
|
|
1555
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1556
|
+
|
|
1557
|
+
if number is None:
|
|
1558
|
+
raise AppwriteException('Missing required parameter: "number"')
|
|
1559
|
+
|
|
1560
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1561
|
+
|
|
1562
|
+
api_params['number'] = self._normalize_value(number)
|
|
1563
|
+
|
|
1564
|
+
response = self.client.call('patch', api_path, {
|
|
1565
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1566
|
+
'content-type': 'application/json',
|
|
1567
|
+
'accept': 'application/json',
|
|
1568
|
+
}, api_params)
|
|
1569
|
+
|
|
1570
|
+
return User.with_data(response, model_type)
|
|
1571
|
+
|
|
1572
|
+
|
|
1573
|
+
def get_prefs(
|
|
1574
|
+
self,
|
|
1575
|
+
user_id: str,
|
|
1576
|
+
model_type: Type[T] = dict
|
|
1577
|
+
) -> Preferences[T]:
|
|
1578
|
+
"""
|
|
1579
|
+
Get the user preferences by its unique ID.
|
|
1580
|
+
|
|
1581
|
+
Parameters
|
|
1582
|
+
----------
|
|
1583
|
+
user_id : str
|
|
1584
|
+
User ID.
|
|
1585
|
+
|
|
1586
|
+
model_type : Type[T], optional
|
|
1587
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1588
|
+
|
|
1589
|
+
Returns
|
|
1590
|
+
-------
|
|
1591
|
+
Preferences[T]
|
|
1592
|
+
API response as a typed Pydantic model
|
|
1593
|
+
|
|
1594
|
+
Raises
|
|
1595
|
+
------
|
|
1596
|
+
AppwriteException
|
|
1597
|
+
If API request fails
|
|
1598
|
+
"""
|
|
1599
|
+
|
|
1600
|
+
api_path = '/users/{userId}/prefs'
|
|
1601
|
+
api_params = {}
|
|
1602
|
+
if user_id is None:
|
|
1603
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1604
|
+
|
|
1605
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1606
|
+
|
|
1607
|
+
|
|
1608
|
+
response = self.client.call('get', api_path, {
|
|
1609
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1610
|
+
'accept': 'application/json',
|
|
1611
|
+
}, api_params)
|
|
1612
|
+
|
|
1613
|
+
return Preferences.with_data(response, model_type)
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
def update_prefs(
|
|
1617
|
+
self,
|
|
1618
|
+
user_id: str,
|
|
1619
|
+
prefs: Dict[str, Any],
|
|
1620
|
+
model_type: Type[T] = dict
|
|
1621
|
+
) -> Preferences[T]:
|
|
1622
|
+
"""
|
|
1623
|
+
Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
|
|
1624
|
+
|
|
1625
|
+
Parameters
|
|
1626
|
+
----------
|
|
1627
|
+
user_id : str
|
|
1628
|
+
User ID.
|
|
1629
|
+
prefs : Dict[str, Any]
|
|
1630
|
+
Prefs key-value JSON object.
|
|
1631
|
+
|
|
1632
|
+
model_type : Type[T], optional
|
|
1633
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1634
|
+
|
|
1635
|
+
Returns
|
|
1636
|
+
-------
|
|
1637
|
+
Preferences[T]
|
|
1638
|
+
API response as a typed Pydantic model
|
|
1639
|
+
|
|
1640
|
+
Raises
|
|
1641
|
+
------
|
|
1642
|
+
AppwriteException
|
|
1643
|
+
If API request fails
|
|
1644
|
+
"""
|
|
1645
|
+
|
|
1646
|
+
api_path = '/users/{userId}/prefs'
|
|
1647
|
+
api_params = {}
|
|
1648
|
+
if user_id is None:
|
|
1649
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1650
|
+
|
|
1651
|
+
if prefs is None:
|
|
1652
|
+
raise AppwriteException('Missing required parameter: "prefs"')
|
|
1653
|
+
|
|
1654
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1655
|
+
|
|
1656
|
+
api_params['prefs'] = self._normalize_value(prefs)
|
|
1657
|
+
|
|
1658
|
+
response = self.client.call('patch', api_path, {
|
|
1659
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1660
|
+
'content-type': 'application/json',
|
|
1661
|
+
'accept': 'application/json',
|
|
1662
|
+
}, api_params)
|
|
1663
|
+
|
|
1664
|
+
return Preferences.with_data(response, model_type)
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
def list_sessions(
|
|
1668
|
+
self,
|
|
1669
|
+
user_id: str,
|
|
1670
|
+
total: Optional[bool] = None
|
|
1671
|
+
) -> SessionList:
|
|
1672
|
+
"""
|
|
1673
|
+
Get the user sessions list by its unique ID.
|
|
1674
|
+
|
|
1675
|
+
Parameters
|
|
1676
|
+
----------
|
|
1677
|
+
user_id : str
|
|
1678
|
+
User ID.
|
|
1679
|
+
total : Optional[bool]
|
|
1680
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
1681
|
+
|
|
1682
|
+
Returns
|
|
1683
|
+
-------
|
|
1684
|
+
SessionList
|
|
1685
|
+
API response as a typed Pydantic model
|
|
1686
|
+
|
|
1687
|
+
Raises
|
|
1688
|
+
------
|
|
1689
|
+
AppwriteException
|
|
1690
|
+
If API request fails
|
|
1691
|
+
"""
|
|
1692
|
+
|
|
1693
|
+
api_path = '/users/{userId}/sessions'
|
|
1694
|
+
api_params = {}
|
|
1695
|
+
if user_id is None:
|
|
1696
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1697
|
+
|
|
1698
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1699
|
+
|
|
1700
|
+
if total is not None:
|
|
1701
|
+
api_params['total'] = self._normalize_value(total)
|
|
1702
|
+
|
|
1703
|
+
response = self.client.call('get', api_path, {
|
|
1704
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1705
|
+
'accept': 'application/json',
|
|
1706
|
+
}, api_params)
|
|
1707
|
+
|
|
1708
|
+
return self._parse_response(response, model=SessionList)
|
|
1709
|
+
|
|
1710
|
+
|
|
1711
|
+
def create_session(
|
|
1712
|
+
self,
|
|
1713
|
+
user_id: str
|
|
1714
|
+
) -> Session:
|
|
1715
|
+
"""
|
|
1716
|
+
Creates a session for a user. Returns an immediately usable session object.
|
|
1717
|
+
|
|
1718
|
+
If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint.
|
|
1719
|
+
|
|
1720
|
+
Parameters
|
|
1721
|
+
----------
|
|
1722
|
+
user_id : str
|
|
1723
|
+
User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
1724
|
+
|
|
1725
|
+
Returns
|
|
1726
|
+
-------
|
|
1727
|
+
Session
|
|
1728
|
+
API response as a typed Pydantic model
|
|
1729
|
+
|
|
1730
|
+
Raises
|
|
1731
|
+
------
|
|
1732
|
+
AppwriteException
|
|
1733
|
+
If API request fails
|
|
1734
|
+
"""
|
|
1735
|
+
|
|
1736
|
+
api_path = '/users/{userId}/sessions'
|
|
1737
|
+
api_params = {}
|
|
1738
|
+
if user_id is None:
|
|
1739
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1740
|
+
|
|
1741
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
response = self.client.call('post', api_path, {
|
|
1745
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1746
|
+
'content-type': 'application/json',
|
|
1747
|
+
'accept': 'application/json',
|
|
1748
|
+
}, api_params)
|
|
1749
|
+
|
|
1750
|
+
return self._parse_response(response, model=Session)
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
def delete_sessions(
|
|
1754
|
+
self,
|
|
1755
|
+
user_id: str
|
|
1756
|
+
) -> Dict[str, Any]:
|
|
1757
|
+
"""
|
|
1758
|
+
Delete all user's sessions by using the user's unique ID.
|
|
1759
|
+
|
|
1760
|
+
Parameters
|
|
1761
|
+
----------
|
|
1762
|
+
user_id : str
|
|
1763
|
+
User ID.
|
|
1764
|
+
|
|
1765
|
+
Returns
|
|
1766
|
+
-------
|
|
1767
|
+
Dict[str, Any]
|
|
1768
|
+
API response as a dictionary
|
|
1769
|
+
|
|
1770
|
+
Raises
|
|
1771
|
+
------
|
|
1772
|
+
AppwriteException
|
|
1773
|
+
If API request fails
|
|
1774
|
+
"""
|
|
1775
|
+
|
|
1776
|
+
api_path = '/users/{userId}/sessions'
|
|
1777
|
+
api_params = {}
|
|
1778
|
+
if user_id is None:
|
|
1779
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1780
|
+
|
|
1781
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1782
|
+
|
|
1783
|
+
|
|
1784
|
+
response = self.client.call('delete', api_path, {
|
|
1785
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1786
|
+
'content-type': 'application/json',
|
|
1787
|
+
}, api_params)
|
|
1788
|
+
|
|
1789
|
+
return response
|
|
1790
|
+
|
|
1791
|
+
|
|
1792
|
+
def delete_session(
|
|
1793
|
+
self,
|
|
1794
|
+
user_id: str,
|
|
1795
|
+
session_id: str
|
|
1796
|
+
) -> Dict[str, Any]:
|
|
1797
|
+
"""
|
|
1798
|
+
Delete a user sessions by its unique ID.
|
|
1799
|
+
|
|
1800
|
+
Parameters
|
|
1801
|
+
----------
|
|
1802
|
+
user_id : str
|
|
1803
|
+
User ID.
|
|
1804
|
+
session_id : str
|
|
1805
|
+
Session ID.
|
|
1806
|
+
|
|
1807
|
+
Returns
|
|
1808
|
+
-------
|
|
1809
|
+
Dict[str, Any]
|
|
1810
|
+
API response as a dictionary
|
|
1811
|
+
|
|
1812
|
+
Raises
|
|
1813
|
+
------
|
|
1814
|
+
AppwriteException
|
|
1815
|
+
If API request fails
|
|
1816
|
+
"""
|
|
1817
|
+
|
|
1818
|
+
api_path = '/users/{userId}/sessions/{sessionId}'
|
|
1819
|
+
api_params = {}
|
|
1820
|
+
if user_id is None:
|
|
1821
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1822
|
+
|
|
1823
|
+
if session_id is None:
|
|
1824
|
+
raise AppwriteException('Missing required parameter: "session_id"')
|
|
1825
|
+
|
|
1826
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1827
|
+
api_path = api_path.replace('{sessionId}', str(self._normalize_value(session_id)))
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
response = self.client.call('delete', api_path, {
|
|
1831
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1832
|
+
'content-type': 'application/json',
|
|
1833
|
+
}, api_params)
|
|
1834
|
+
|
|
1835
|
+
return response
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
def update_status(
|
|
1839
|
+
self,
|
|
1840
|
+
user_id: str,
|
|
1841
|
+
status: bool,
|
|
1842
|
+
model_type: Type[T] = dict
|
|
1843
|
+
) -> User[T]:
|
|
1844
|
+
"""
|
|
1845
|
+
Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved.
|
|
1846
|
+
|
|
1847
|
+
Parameters
|
|
1848
|
+
----------
|
|
1849
|
+
user_id : str
|
|
1850
|
+
User ID.
|
|
1851
|
+
status : bool
|
|
1852
|
+
User Status. To activate the user pass `true` and to block the user pass `false`.
|
|
1853
|
+
|
|
1854
|
+
model_type : Type[T], optional
|
|
1855
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1856
|
+
|
|
1857
|
+
Returns
|
|
1858
|
+
-------
|
|
1859
|
+
User[T]
|
|
1860
|
+
API response as a typed Pydantic model
|
|
1861
|
+
|
|
1862
|
+
Raises
|
|
1863
|
+
------
|
|
1864
|
+
AppwriteException
|
|
1865
|
+
If API request fails
|
|
1866
|
+
"""
|
|
1867
|
+
|
|
1868
|
+
api_path = '/users/{userId}/status'
|
|
1869
|
+
api_params = {}
|
|
1870
|
+
if user_id is None:
|
|
1871
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1872
|
+
|
|
1873
|
+
if status is None:
|
|
1874
|
+
raise AppwriteException('Missing required parameter: "status"')
|
|
1875
|
+
|
|
1876
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1877
|
+
|
|
1878
|
+
api_params['status'] = self._normalize_value(status)
|
|
1879
|
+
|
|
1880
|
+
response = self.client.call('patch', api_path, {
|
|
1881
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1882
|
+
'content-type': 'application/json',
|
|
1883
|
+
'accept': 'application/json',
|
|
1884
|
+
}, api_params)
|
|
1885
|
+
|
|
1886
|
+
return User.with_data(response, model_type)
|
|
1887
|
+
|
|
1888
|
+
|
|
1889
|
+
def list_targets(
|
|
1890
|
+
self,
|
|
1891
|
+
user_id: str,
|
|
1892
|
+
queries: Optional[List[str]] = None,
|
|
1893
|
+
total: Optional[bool] = None
|
|
1894
|
+
) -> TargetList:
|
|
1895
|
+
"""
|
|
1896
|
+
List the messaging targets that are associated with a user.
|
|
1897
|
+
|
|
1898
|
+
Parameters
|
|
1899
|
+
----------
|
|
1900
|
+
user_id : str
|
|
1901
|
+
User ID.
|
|
1902
|
+
queries : Optional[List[str]]
|
|
1903
|
+
Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType
|
|
1904
|
+
total : Optional[bool]
|
|
1905
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
1906
|
+
|
|
1907
|
+
Returns
|
|
1908
|
+
-------
|
|
1909
|
+
TargetList
|
|
1910
|
+
API response as a typed Pydantic model
|
|
1911
|
+
|
|
1912
|
+
Raises
|
|
1913
|
+
------
|
|
1914
|
+
AppwriteException
|
|
1915
|
+
If API request fails
|
|
1916
|
+
"""
|
|
1917
|
+
|
|
1918
|
+
api_path = '/users/{userId}/targets'
|
|
1919
|
+
api_params = {}
|
|
1920
|
+
if user_id is None:
|
|
1921
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1922
|
+
|
|
1923
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1924
|
+
|
|
1925
|
+
if queries is not None:
|
|
1926
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
1927
|
+
if total is not None:
|
|
1928
|
+
api_params['total'] = self._normalize_value(total)
|
|
1929
|
+
|
|
1930
|
+
response = self.client.call('get', api_path, {
|
|
1931
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1932
|
+
'accept': 'application/json',
|
|
1933
|
+
}, api_params)
|
|
1934
|
+
|
|
1935
|
+
return self._parse_response(response, model=TargetList)
|
|
1936
|
+
|
|
1937
|
+
|
|
1938
|
+
def create_target(
|
|
1939
|
+
self,
|
|
1940
|
+
user_id: str,
|
|
1941
|
+
target_id: str,
|
|
1942
|
+
provider_type: MessagingProviderType,
|
|
1943
|
+
identifier: str,
|
|
1944
|
+
provider_id: Optional[str] = None,
|
|
1945
|
+
name: Optional[str] = None
|
|
1946
|
+
) -> Target:
|
|
1947
|
+
"""
|
|
1948
|
+
Create a messaging target.
|
|
1949
|
+
|
|
1950
|
+
Parameters
|
|
1951
|
+
----------
|
|
1952
|
+
user_id : str
|
|
1953
|
+
User ID.
|
|
1954
|
+
target_id : str
|
|
1955
|
+
Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
1956
|
+
provider_type : MessagingProviderType
|
|
1957
|
+
The target provider type. Can be one of the following: `email`, `sms` or `push`.
|
|
1958
|
+
identifier : str
|
|
1959
|
+
The target identifier (token, email, phone etc.)
|
|
1960
|
+
provider_id : Optional[str]
|
|
1961
|
+
Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
|
|
1962
|
+
name : Optional[str]
|
|
1963
|
+
Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.
|
|
1964
|
+
|
|
1965
|
+
Returns
|
|
1966
|
+
-------
|
|
1967
|
+
Target
|
|
1968
|
+
API response as a typed Pydantic model
|
|
1969
|
+
|
|
1970
|
+
Raises
|
|
1971
|
+
------
|
|
1972
|
+
AppwriteException
|
|
1973
|
+
If API request fails
|
|
1974
|
+
"""
|
|
1975
|
+
|
|
1976
|
+
api_path = '/users/{userId}/targets'
|
|
1977
|
+
api_params = {}
|
|
1978
|
+
if user_id is None:
|
|
1979
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
1980
|
+
|
|
1981
|
+
if target_id is None:
|
|
1982
|
+
raise AppwriteException('Missing required parameter: "target_id"')
|
|
1983
|
+
|
|
1984
|
+
if provider_type is None:
|
|
1985
|
+
raise AppwriteException('Missing required parameter: "provider_type"')
|
|
1986
|
+
|
|
1987
|
+
if identifier is None:
|
|
1988
|
+
raise AppwriteException('Missing required parameter: "identifier"')
|
|
1989
|
+
|
|
1990
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
1991
|
+
|
|
1992
|
+
api_params['targetId'] = self._normalize_value(target_id)
|
|
1993
|
+
api_params['providerType'] = self._normalize_value(provider_type)
|
|
1994
|
+
api_params['identifier'] = self._normalize_value(identifier)
|
|
1995
|
+
if provider_id is not None:
|
|
1996
|
+
api_params['providerId'] = self._normalize_value(provider_id)
|
|
1997
|
+
if name is not None:
|
|
1998
|
+
api_params['name'] = self._normalize_value(name)
|
|
1999
|
+
|
|
2000
|
+
response = self.client.call('post', api_path, {
|
|
2001
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
2002
|
+
'content-type': 'application/json',
|
|
2003
|
+
'accept': 'application/json',
|
|
2004
|
+
}, api_params)
|
|
2005
|
+
|
|
2006
|
+
return self._parse_response(response, model=Target)
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
def get_target(
|
|
2010
|
+
self,
|
|
2011
|
+
user_id: str,
|
|
2012
|
+
target_id: str
|
|
2013
|
+
) -> Target:
|
|
2014
|
+
"""
|
|
2015
|
+
Get a user's push notification target by ID.
|
|
2016
|
+
|
|
2017
|
+
Parameters
|
|
2018
|
+
----------
|
|
2019
|
+
user_id : str
|
|
2020
|
+
User ID.
|
|
2021
|
+
target_id : str
|
|
2022
|
+
Target ID.
|
|
2023
|
+
|
|
2024
|
+
Returns
|
|
2025
|
+
-------
|
|
2026
|
+
Target
|
|
2027
|
+
API response as a typed Pydantic model
|
|
2028
|
+
|
|
2029
|
+
Raises
|
|
2030
|
+
------
|
|
2031
|
+
AppwriteException
|
|
2032
|
+
If API request fails
|
|
2033
|
+
"""
|
|
2034
|
+
|
|
2035
|
+
api_path = '/users/{userId}/targets/{targetId}'
|
|
2036
|
+
api_params = {}
|
|
2037
|
+
if user_id is None:
|
|
2038
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
2039
|
+
|
|
2040
|
+
if target_id is None:
|
|
2041
|
+
raise AppwriteException('Missing required parameter: "target_id"')
|
|
2042
|
+
|
|
2043
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
2044
|
+
api_path = api_path.replace('{targetId}', str(self._normalize_value(target_id)))
|
|
2045
|
+
|
|
2046
|
+
|
|
2047
|
+
response = self.client.call('get', api_path, {
|
|
2048
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
2049
|
+
'accept': 'application/json',
|
|
2050
|
+
}, api_params)
|
|
2051
|
+
|
|
2052
|
+
return self._parse_response(response, model=Target)
|
|
2053
|
+
|
|
2054
|
+
|
|
2055
|
+
def update_target(
|
|
2056
|
+
self,
|
|
2057
|
+
user_id: str,
|
|
2058
|
+
target_id: str,
|
|
2059
|
+
identifier: Optional[str] = None,
|
|
2060
|
+
provider_id: Optional[str] = None,
|
|
2061
|
+
name: Optional[str] = None
|
|
2062
|
+
) -> Target:
|
|
2063
|
+
"""
|
|
2064
|
+
Update a messaging target.
|
|
2065
|
+
|
|
2066
|
+
Parameters
|
|
2067
|
+
----------
|
|
2068
|
+
user_id : str
|
|
2069
|
+
User ID.
|
|
2070
|
+
target_id : str
|
|
2071
|
+
Target ID.
|
|
2072
|
+
identifier : Optional[str]
|
|
2073
|
+
The target identifier (token, email, phone etc.)
|
|
2074
|
+
provider_id : Optional[str]
|
|
2075
|
+
Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
|
|
2076
|
+
name : Optional[str]
|
|
2077
|
+
Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.
|
|
2078
|
+
|
|
2079
|
+
Returns
|
|
2080
|
+
-------
|
|
2081
|
+
Target
|
|
2082
|
+
API response as a typed Pydantic model
|
|
2083
|
+
|
|
2084
|
+
Raises
|
|
2085
|
+
------
|
|
2086
|
+
AppwriteException
|
|
2087
|
+
If API request fails
|
|
2088
|
+
"""
|
|
2089
|
+
|
|
2090
|
+
api_path = '/users/{userId}/targets/{targetId}'
|
|
2091
|
+
api_params = {}
|
|
2092
|
+
if user_id is None:
|
|
2093
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
2094
|
+
|
|
2095
|
+
if target_id is None:
|
|
2096
|
+
raise AppwriteException('Missing required parameter: "target_id"')
|
|
2097
|
+
|
|
2098
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
2099
|
+
api_path = api_path.replace('{targetId}', str(self._normalize_value(target_id)))
|
|
2100
|
+
|
|
2101
|
+
if identifier is not None:
|
|
2102
|
+
api_params['identifier'] = self._normalize_value(identifier)
|
|
2103
|
+
if provider_id is not None:
|
|
2104
|
+
api_params['providerId'] = self._normalize_value(provider_id)
|
|
2105
|
+
if name is not None:
|
|
2106
|
+
api_params['name'] = self._normalize_value(name)
|
|
2107
|
+
|
|
2108
|
+
response = self.client.call('patch', api_path, {
|
|
2109
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
2110
|
+
'content-type': 'application/json',
|
|
2111
|
+
'accept': 'application/json',
|
|
2112
|
+
}, api_params)
|
|
2113
|
+
|
|
2114
|
+
return self._parse_response(response, model=Target)
|
|
2115
|
+
|
|
2116
|
+
|
|
2117
|
+
def delete_target(
|
|
2118
|
+
self,
|
|
2119
|
+
user_id: str,
|
|
2120
|
+
target_id: str
|
|
2121
|
+
) -> Dict[str, Any]:
|
|
2122
|
+
"""
|
|
2123
|
+
Delete a messaging target.
|
|
2124
|
+
|
|
2125
|
+
Parameters
|
|
2126
|
+
----------
|
|
2127
|
+
user_id : str
|
|
2128
|
+
User ID.
|
|
2129
|
+
target_id : str
|
|
2130
|
+
Target ID.
|
|
2131
|
+
|
|
2132
|
+
Returns
|
|
2133
|
+
-------
|
|
2134
|
+
Dict[str, Any]
|
|
2135
|
+
API response as a dictionary
|
|
2136
|
+
|
|
2137
|
+
Raises
|
|
2138
|
+
------
|
|
2139
|
+
AppwriteException
|
|
2140
|
+
If API request fails
|
|
2141
|
+
"""
|
|
2142
|
+
|
|
2143
|
+
api_path = '/users/{userId}/targets/{targetId}'
|
|
2144
|
+
api_params = {}
|
|
2145
|
+
if user_id is None:
|
|
2146
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
2147
|
+
|
|
2148
|
+
if target_id is None:
|
|
2149
|
+
raise AppwriteException('Missing required parameter: "target_id"')
|
|
2150
|
+
|
|
2151
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
2152
|
+
api_path = api_path.replace('{targetId}', str(self._normalize_value(target_id)))
|
|
2153
|
+
|
|
2154
|
+
|
|
2155
|
+
response = self.client.call('delete', api_path, {
|
|
2156
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
2157
|
+
'content-type': 'application/json',
|
|
2158
|
+
}, api_params)
|
|
2159
|
+
|
|
2160
|
+
return response
|
|
2161
|
+
|
|
2162
|
+
|
|
2163
|
+
def create_token(
|
|
2164
|
+
self,
|
|
2165
|
+
user_id: str,
|
|
2166
|
+
length: Optional[float] = None,
|
|
2167
|
+
expire: Optional[float] = None
|
|
2168
|
+
) -> Token:
|
|
2169
|
+
"""
|
|
2170
|
+
Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process.
|
|
2171
|
+
|
|
2172
|
+
|
|
2173
|
+
Parameters
|
|
2174
|
+
----------
|
|
2175
|
+
user_id : str
|
|
2176
|
+
User ID.
|
|
2177
|
+
length : Optional[float]
|
|
2178
|
+
Token length in characters. The default length is 6 characters
|
|
2179
|
+
expire : Optional[float]
|
|
2180
|
+
Token expiration period in seconds. The default expiration is 15 minutes.
|
|
2181
|
+
|
|
2182
|
+
Returns
|
|
2183
|
+
-------
|
|
2184
|
+
Token
|
|
2185
|
+
API response as a typed Pydantic model
|
|
2186
|
+
|
|
2187
|
+
Raises
|
|
2188
|
+
------
|
|
2189
|
+
AppwriteException
|
|
2190
|
+
If API request fails
|
|
2191
|
+
"""
|
|
2192
|
+
|
|
2193
|
+
api_path = '/users/{userId}/tokens'
|
|
2194
|
+
api_params = {}
|
|
2195
|
+
if user_id is None:
|
|
2196
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
2197
|
+
|
|
2198
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
2199
|
+
|
|
2200
|
+
if length is not None:
|
|
2201
|
+
api_params['length'] = self._normalize_value(length)
|
|
2202
|
+
if expire is not None:
|
|
2203
|
+
api_params['expire'] = self._normalize_value(expire)
|
|
2204
|
+
|
|
2205
|
+
response = self.client.call('post', api_path, {
|
|
2206
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
2207
|
+
'content-type': 'application/json',
|
|
2208
|
+
'accept': 'application/json',
|
|
2209
|
+
}, api_params)
|
|
2210
|
+
|
|
2211
|
+
return self._parse_response(response, model=Token)
|
|
2212
|
+
|
|
2213
|
+
|
|
2214
|
+
def update_email_verification(
|
|
2215
|
+
self,
|
|
2216
|
+
user_id: str,
|
|
2217
|
+
email_verification: bool,
|
|
2218
|
+
model_type: Type[T] = dict
|
|
2219
|
+
) -> User[T]:
|
|
2220
|
+
"""
|
|
2221
|
+
Update the user email verification status by its unique ID.
|
|
2222
|
+
|
|
2223
|
+
Parameters
|
|
2224
|
+
----------
|
|
2225
|
+
user_id : str
|
|
2226
|
+
User ID.
|
|
2227
|
+
email_verification : bool
|
|
2228
|
+
User email verification status.
|
|
2229
|
+
|
|
2230
|
+
model_type : Type[T], optional
|
|
2231
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
2232
|
+
|
|
2233
|
+
Returns
|
|
2234
|
+
-------
|
|
2235
|
+
User[T]
|
|
2236
|
+
API response as a typed Pydantic model
|
|
2237
|
+
|
|
2238
|
+
Raises
|
|
2239
|
+
------
|
|
2240
|
+
AppwriteException
|
|
2241
|
+
If API request fails
|
|
2242
|
+
"""
|
|
2243
|
+
|
|
2244
|
+
api_path = '/users/{userId}/verification'
|
|
2245
|
+
api_params = {}
|
|
2246
|
+
if user_id is None:
|
|
2247
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
2248
|
+
|
|
2249
|
+
if email_verification is None:
|
|
2250
|
+
raise AppwriteException('Missing required parameter: "email_verification"')
|
|
2251
|
+
|
|
2252
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
2253
|
+
|
|
2254
|
+
api_params['emailVerification'] = self._normalize_value(email_verification)
|
|
2255
|
+
|
|
2256
|
+
response = self.client.call('patch', api_path, {
|
|
2257
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
2258
|
+
'content-type': 'application/json',
|
|
2259
|
+
'accept': 'application/json',
|
|
2260
|
+
}, api_params)
|
|
2261
|
+
|
|
2262
|
+
return User.with_data(response, model_type)
|
|
2263
|
+
|
|
2264
|
+
|
|
2265
|
+
def update_phone_verification(
|
|
2266
|
+
self,
|
|
2267
|
+
user_id: str,
|
|
2268
|
+
phone_verification: bool,
|
|
2269
|
+
model_type: Type[T] = dict
|
|
2270
|
+
) -> User[T]:
|
|
2271
|
+
"""
|
|
2272
|
+
Update the user phone verification status by its unique ID.
|
|
2273
|
+
|
|
2274
|
+
Parameters
|
|
2275
|
+
----------
|
|
2276
|
+
user_id : str
|
|
2277
|
+
User ID.
|
|
2278
|
+
phone_verification : bool
|
|
2279
|
+
User phone verification status.
|
|
2280
|
+
|
|
2281
|
+
model_type : Type[T], optional
|
|
2282
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
2283
|
+
|
|
2284
|
+
Returns
|
|
2285
|
+
-------
|
|
2286
|
+
User[T]
|
|
2287
|
+
API response as a typed Pydantic model
|
|
2288
|
+
|
|
2289
|
+
Raises
|
|
2290
|
+
------
|
|
2291
|
+
AppwriteException
|
|
2292
|
+
If API request fails
|
|
2293
|
+
"""
|
|
2294
|
+
|
|
2295
|
+
api_path = '/users/{userId}/verification/phone'
|
|
2296
|
+
api_params = {}
|
|
2297
|
+
if user_id is None:
|
|
2298
|
+
raise AppwriteException('Missing required parameter: "user_id"')
|
|
2299
|
+
|
|
2300
|
+
if phone_verification is None:
|
|
2301
|
+
raise AppwriteException('Missing required parameter: "phone_verification"')
|
|
2302
|
+
|
|
2303
|
+
api_path = api_path.replace('{userId}', str(self._normalize_value(user_id)))
|
|
2304
|
+
|
|
2305
|
+
api_params['phoneVerification'] = self._normalize_value(phone_verification)
|
|
2306
|
+
|
|
2307
|
+
response = self.client.call('patch', api_path, {
|
|
2308
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
2309
|
+
'content-type': 'application/json',
|
|
2310
|
+
'accept': 'application/json',
|
|
2311
|
+
}, api_params)
|
|
2312
|
+
|
|
2313
|
+
return User.with_data(response, model_type)
|
|
2314
|
+
|