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,2052 @@
|
|
|
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.database_list import DatabaseList
|
|
7
|
+
from ..models.database import Database
|
|
8
|
+
from ..models.dedicated_database_specification_list import DedicatedDatabaseSpecificationList
|
|
9
|
+
from ..models.transaction_list import TransactionList
|
|
10
|
+
from ..models.transaction import Transaction
|
|
11
|
+
from ..models.collection_list import CollectionList
|
|
12
|
+
from ..models.collection import Collection
|
|
13
|
+
from ..models.document_list import DocumentList
|
|
14
|
+
from ..models.document import Document
|
|
15
|
+
from ..models.index_list import IndexList
|
|
16
|
+
from ..enums.documents_db_index_type import DocumentsDBIndexType
|
|
17
|
+
from ..enums.order_by import OrderBy
|
|
18
|
+
from ..models.index import Index
|
|
19
|
+
from ..models.dedicated_database import DedicatedDatabase
|
|
20
|
+
from ..models.dedicated_database_operation_list import DedicatedDatabaseOperationList
|
|
21
|
+
from ..models.dedicated_database_replicas import DedicatedDatabaseReplicas
|
|
22
|
+
from ..models.database_status import DatabaseStatus
|
|
23
|
+
|
|
24
|
+
T = TypeVar('T')
|
|
25
|
+
|
|
26
|
+
class DocumentsDB(Service):
|
|
27
|
+
|
|
28
|
+
def __init__(self, client) -> None:
|
|
29
|
+
super(DocumentsDB, self).__init__(client)
|
|
30
|
+
|
|
31
|
+
def list(
|
|
32
|
+
self,
|
|
33
|
+
queries: Optional[List[str]] = None,
|
|
34
|
+
total: Optional[bool] = None
|
|
35
|
+
) -> DatabaseList:
|
|
36
|
+
"""
|
|
37
|
+
Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.
|
|
38
|
+
|
|
39
|
+
Parameters
|
|
40
|
+
----------
|
|
41
|
+
queries : Optional[List[str]]
|
|
42
|
+
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 columns: name
|
|
43
|
+
total : Optional[bool]
|
|
44
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
45
|
+
|
|
46
|
+
Returns
|
|
47
|
+
-------
|
|
48
|
+
DatabaseList
|
|
49
|
+
API response as a typed Pydantic model
|
|
50
|
+
|
|
51
|
+
Raises
|
|
52
|
+
------
|
|
53
|
+
AppwriteException
|
|
54
|
+
If API request fails
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
api_path = '/documentsdb'
|
|
58
|
+
api_params = {}
|
|
59
|
+
|
|
60
|
+
if queries is not None:
|
|
61
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
62
|
+
if total is not None:
|
|
63
|
+
api_params['total'] = self._normalize_value(total)
|
|
64
|
+
|
|
65
|
+
response = self.client.call('get', api_path, {
|
|
66
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
67
|
+
'accept': 'application/json',
|
|
68
|
+
}, api_params)
|
|
69
|
+
|
|
70
|
+
return self._parse_response(response, model=DatabaseList)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def create(
|
|
74
|
+
self,
|
|
75
|
+
database_id: str,
|
|
76
|
+
name: str,
|
|
77
|
+
enabled: Optional[bool] = None,
|
|
78
|
+
specification: Optional[str] = None,
|
|
79
|
+
replicas: Optional[float] = None,
|
|
80
|
+
sync_mode: Optional[str] = None
|
|
81
|
+
) -> Database:
|
|
82
|
+
"""
|
|
83
|
+
Create a new Database.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
database_id : str
|
|
89
|
+
Unique 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.
|
|
90
|
+
name : str
|
|
91
|
+
Database name. Max length: 128 chars.
|
|
92
|
+
enabled : Optional[bool]
|
|
93
|
+
Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
|
|
94
|
+
specification : Optional[str]
|
|
95
|
+
Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification.
|
|
96
|
+
replicas : Optional[float]
|
|
97
|
+
Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0.
|
|
98
|
+
sync_mode : Optional[str]
|
|
99
|
+
Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum.
|
|
100
|
+
|
|
101
|
+
Returns
|
|
102
|
+
-------
|
|
103
|
+
Database
|
|
104
|
+
API response as a typed Pydantic model
|
|
105
|
+
|
|
106
|
+
Raises
|
|
107
|
+
------
|
|
108
|
+
AppwriteException
|
|
109
|
+
If API request fails
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
api_path = '/documentsdb'
|
|
113
|
+
api_params = {}
|
|
114
|
+
if database_id is None:
|
|
115
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
116
|
+
|
|
117
|
+
if name is None:
|
|
118
|
+
raise AppwriteException('Missing required parameter: "name"')
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
api_params['databaseId'] = self._normalize_value(database_id)
|
|
122
|
+
api_params['name'] = self._normalize_value(name)
|
|
123
|
+
if enabled is not None:
|
|
124
|
+
api_params['enabled'] = self._normalize_value(enabled)
|
|
125
|
+
if specification is not None:
|
|
126
|
+
api_params['specification'] = self._normalize_value(specification)
|
|
127
|
+
if replicas is not None:
|
|
128
|
+
api_params['replicas'] = self._normalize_value(replicas)
|
|
129
|
+
if sync_mode is not None:
|
|
130
|
+
api_params['syncMode'] = self._normalize_value(sync_mode)
|
|
131
|
+
|
|
132
|
+
response = self.client.call('post', api_path, {
|
|
133
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
134
|
+
'content-type': 'application/json',
|
|
135
|
+
'accept': 'application/json',
|
|
136
|
+
}, api_params)
|
|
137
|
+
|
|
138
|
+
return self._parse_response(response, model=Database)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def list_specifications(
|
|
142
|
+
self
|
|
143
|
+
) -> DedicatedDatabaseSpecificationList:
|
|
144
|
+
"""
|
|
145
|
+
List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization.
|
|
146
|
+
|
|
147
|
+
Returns
|
|
148
|
+
-------
|
|
149
|
+
DedicatedDatabaseSpecificationList
|
|
150
|
+
API response as a typed Pydantic model
|
|
151
|
+
|
|
152
|
+
Raises
|
|
153
|
+
------
|
|
154
|
+
AppwriteException
|
|
155
|
+
If API request fails
|
|
156
|
+
"""
|
|
157
|
+
|
|
158
|
+
api_path = '/documentsdb/specifications'
|
|
159
|
+
api_params = {}
|
|
160
|
+
|
|
161
|
+
response = self.client.call('get', api_path, {
|
|
162
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
163
|
+
'accept': 'application/json',
|
|
164
|
+
}, api_params)
|
|
165
|
+
|
|
166
|
+
return self._parse_response(response, model=DedicatedDatabaseSpecificationList)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def list_transactions(
|
|
170
|
+
self,
|
|
171
|
+
queries: Optional[List[str]] = None
|
|
172
|
+
) -> TransactionList:
|
|
173
|
+
"""
|
|
174
|
+
List transactions across all databases.
|
|
175
|
+
|
|
176
|
+
Parameters
|
|
177
|
+
----------
|
|
178
|
+
queries : Optional[List[str]]
|
|
179
|
+
Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
|
|
180
|
+
|
|
181
|
+
Returns
|
|
182
|
+
-------
|
|
183
|
+
TransactionList
|
|
184
|
+
API response as a typed Pydantic model
|
|
185
|
+
|
|
186
|
+
Raises
|
|
187
|
+
------
|
|
188
|
+
AppwriteException
|
|
189
|
+
If API request fails
|
|
190
|
+
"""
|
|
191
|
+
|
|
192
|
+
api_path = '/documentsdb/transactions'
|
|
193
|
+
api_params = {}
|
|
194
|
+
|
|
195
|
+
if queries is not None:
|
|
196
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
197
|
+
|
|
198
|
+
response = self.client.call('get', api_path, {
|
|
199
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
200
|
+
'accept': 'application/json',
|
|
201
|
+
}, api_params)
|
|
202
|
+
|
|
203
|
+
return self._parse_response(response, model=TransactionList)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def create_transaction(
|
|
207
|
+
self,
|
|
208
|
+
ttl: Optional[float] = None
|
|
209
|
+
) -> Transaction:
|
|
210
|
+
"""
|
|
211
|
+
Create a new transaction.
|
|
212
|
+
|
|
213
|
+
Parameters
|
|
214
|
+
----------
|
|
215
|
+
ttl : Optional[float]
|
|
216
|
+
Seconds before the transaction expires.
|
|
217
|
+
|
|
218
|
+
Returns
|
|
219
|
+
-------
|
|
220
|
+
Transaction
|
|
221
|
+
API response as a typed Pydantic model
|
|
222
|
+
|
|
223
|
+
Raises
|
|
224
|
+
------
|
|
225
|
+
AppwriteException
|
|
226
|
+
If API request fails
|
|
227
|
+
"""
|
|
228
|
+
|
|
229
|
+
api_path = '/documentsdb/transactions'
|
|
230
|
+
api_params = {}
|
|
231
|
+
|
|
232
|
+
if ttl is not None:
|
|
233
|
+
api_params['ttl'] = self._normalize_value(ttl)
|
|
234
|
+
|
|
235
|
+
response = self.client.call('post', api_path, {
|
|
236
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
237
|
+
'content-type': 'application/json',
|
|
238
|
+
'accept': 'application/json',
|
|
239
|
+
}, api_params)
|
|
240
|
+
|
|
241
|
+
return self._parse_response(response, model=Transaction)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def get_transaction(
|
|
245
|
+
self,
|
|
246
|
+
transaction_id: str
|
|
247
|
+
) -> Transaction:
|
|
248
|
+
"""
|
|
249
|
+
Get a transaction by its unique ID.
|
|
250
|
+
|
|
251
|
+
Parameters
|
|
252
|
+
----------
|
|
253
|
+
transaction_id : str
|
|
254
|
+
Transaction ID.
|
|
255
|
+
|
|
256
|
+
Returns
|
|
257
|
+
-------
|
|
258
|
+
Transaction
|
|
259
|
+
API response as a typed Pydantic model
|
|
260
|
+
|
|
261
|
+
Raises
|
|
262
|
+
------
|
|
263
|
+
AppwriteException
|
|
264
|
+
If API request fails
|
|
265
|
+
"""
|
|
266
|
+
|
|
267
|
+
api_path = '/documentsdb/transactions/{transactionId}'
|
|
268
|
+
api_params = {}
|
|
269
|
+
if transaction_id is None:
|
|
270
|
+
raise AppwriteException('Missing required parameter: "transaction_id"')
|
|
271
|
+
|
|
272
|
+
api_path = api_path.replace('{transactionId}', str(self._normalize_value(transaction_id)))
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
response = self.client.call('get', api_path, {
|
|
276
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
277
|
+
'accept': 'application/json',
|
|
278
|
+
}, api_params)
|
|
279
|
+
|
|
280
|
+
return self._parse_response(response, model=Transaction)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def update_transaction(
|
|
284
|
+
self,
|
|
285
|
+
transaction_id: str,
|
|
286
|
+
commit: Optional[bool] = None,
|
|
287
|
+
rollback: Optional[bool] = None
|
|
288
|
+
) -> Transaction:
|
|
289
|
+
"""
|
|
290
|
+
Update a transaction, to either commit or roll back its operations.
|
|
291
|
+
|
|
292
|
+
Parameters
|
|
293
|
+
----------
|
|
294
|
+
transaction_id : str
|
|
295
|
+
Transaction ID.
|
|
296
|
+
commit : Optional[bool]
|
|
297
|
+
Commit transaction?
|
|
298
|
+
rollback : Optional[bool]
|
|
299
|
+
Rollback transaction?
|
|
300
|
+
|
|
301
|
+
Returns
|
|
302
|
+
-------
|
|
303
|
+
Transaction
|
|
304
|
+
API response as a typed Pydantic model
|
|
305
|
+
|
|
306
|
+
Raises
|
|
307
|
+
------
|
|
308
|
+
AppwriteException
|
|
309
|
+
If API request fails
|
|
310
|
+
"""
|
|
311
|
+
|
|
312
|
+
api_path = '/documentsdb/transactions/{transactionId}'
|
|
313
|
+
api_params = {}
|
|
314
|
+
if transaction_id is None:
|
|
315
|
+
raise AppwriteException('Missing required parameter: "transaction_id"')
|
|
316
|
+
|
|
317
|
+
api_path = api_path.replace('{transactionId}', str(self._normalize_value(transaction_id)))
|
|
318
|
+
|
|
319
|
+
if commit is not None:
|
|
320
|
+
api_params['commit'] = self._normalize_value(commit)
|
|
321
|
+
if rollback is not None:
|
|
322
|
+
api_params['rollback'] = self._normalize_value(rollback)
|
|
323
|
+
|
|
324
|
+
response = self.client.call('patch', api_path, {
|
|
325
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
326
|
+
'content-type': 'application/json',
|
|
327
|
+
'accept': 'application/json',
|
|
328
|
+
}, api_params)
|
|
329
|
+
|
|
330
|
+
return self._parse_response(response, model=Transaction)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def delete_transaction(
|
|
334
|
+
self,
|
|
335
|
+
transaction_id: str
|
|
336
|
+
) -> Dict[str, Any]:
|
|
337
|
+
"""
|
|
338
|
+
Delete a transaction by its unique ID.
|
|
339
|
+
|
|
340
|
+
Parameters
|
|
341
|
+
----------
|
|
342
|
+
transaction_id : str
|
|
343
|
+
Transaction ID.
|
|
344
|
+
|
|
345
|
+
Returns
|
|
346
|
+
-------
|
|
347
|
+
Dict[str, Any]
|
|
348
|
+
API response as a dictionary
|
|
349
|
+
|
|
350
|
+
Raises
|
|
351
|
+
------
|
|
352
|
+
AppwriteException
|
|
353
|
+
If API request fails
|
|
354
|
+
"""
|
|
355
|
+
|
|
356
|
+
api_path = '/documentsdb/transactions/{transactionId}'
|
|
357
|
+
api_params = {}
|
|
358
|
+
if transaction_id is None:
|
|
359
|
+
raise AppwriteException('Missing required parameter: "transaction_id"')
|
|
360
|
+
|
|
361
|
+
api_path = api_path.replace('{transactionId}', str(self._normalize_value(transaction_id)))
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
response = self.client.call('delete', api_path, {
|
|
365
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
366
|
+
'content-type': 'application/json',
|
|
367
|
+
}, api_params)
|
|
368
|
+
|
|
369
|
+
return response
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def get(
|
|
373
|
+
self,
|
|
374
|
+
database_id: str
|
|
375
|
+
) -> Database:
|
|
376
|
+
"""
|
|
377
|
+
Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
|
|
378
|
+
|
|
379
|
+
Parameters
|
|
380
|
+
----------
|
|
381
|
+
database_id : str
|
|
382
|
+
Database ID.
|
|
383
|
+
|
|
384
|
+
Returns
|
|
385
|
+
-------
|
|
386
|
+
Database
|
|
387
|
+
API response as a typed Pydantic model
|
|
388
|
+
|
|
389
|
+
Raises
|
|
390
|
+
------
|
|
391
|
+
AppwriteException
|
|
392
|
+
If API request fails
|
|
393
|
+
"""
|
|
394
|
+
|
|
395
|
+
api_path = '/documentsdb/{databaseId}'
|
|
396
|
+
api_params = {}
|
|
397
|
+
if database_id is None:
|
|
398
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
399
|
+
|
|
400
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
response = self.client.call('get', api_path, {
|
|
404
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
405
|
+
'accept': 'application/json',
|
|
406
|
+
}, api_params)
|
|
407
|
+
|
|
408
|
+
return self._parse_response(response, model=Database)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def update(
|
|
412
|
+
self,
|
|
413
|
+
database_id: str,
|
|
414
|
+
name: str,
|
|
415
|
+
enabled: Optional[bool] = None,
|
|
416
|
+
specification: Optional[str] = None,
|
|
417
|
+
replicas: Optional[float] = None,
|
|
418
|
+
sync_mode: Optional[str] = None
|
|
419
|
+
) -> Database:
|
|
420
|
+
"""
|
|
421
|
+
Update a database by its unique ID.
|
|
422
|
+
|
|
423
|
+
Parameters
|
|
424
|
+
----------
|
|
425
|
+
database_id : str
|
|
426
|
+
Database ID.
|
|
427
|
+
name : str
|
|
428
|
+
Database name. Max length: 128 chars.
|
|
429
|
+
enabled : Optional[bool]
|
|
430
|
+
Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
|
|
431
|
+
specification : Optional[str]
|
|
432
|
+
Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize.
|
|
433
|
+
replicas : Optional[float]
|
|
434
|
+
Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0.
|
|
435
|
+
sync_mode : Optional[str]
|
|
436
|
+
Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum.
|
|
437
|
+
|
|
438
|
+
Returns
|
|
439
|
+
-------
|
|
440
|
+
Database
|
|
441
|
+
API response as a typed Pydantic model
|
|
442
|
+
|
|
443
|
+
Raises
|
|
444
|
+
------
|
|
445
|
+
AppwriteException
|
|
446
|
+
If API request fails
|
|
447
|
+
"""
|
|
448
|
+
|
|
449
|
+
api_path = '/documentsdb/{databaseId}'
|
|
450
|
+
api_params = {}
|
|
451
|
+
if database_id is None:
|
|
452
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
453
|
+
|
|
454
|
+
if name is None:
|
|
455
|
+
raise AppwriteException('Missing required parameter: "name"')
|
|
456
|
+
|
|
457
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
458
|
+
|
|
459
|
+
api_params['name'] = self._normalize_value(name)
|
|
460
|
+
if enabled is not None:
|
|
461
|
+
api_params['enabled'] = self._normalize_value(enabled)
|
|
462
|
+
if specification is not None:
|
|
463
|
+
api_params['specification'] = self._normalize_value(specification)
|
|
464
|
+
if replicas is not None:
|
|
465
|
+
api_params['replicas'] = self._normalize_value(replicas)
|
|
466
|
+
if sync_mode is not None:
|
|
467
|
+
api_params['syncMode'] = self._normalize_value(sync_mode)
|
|
468
|
+
|
|
469
|
+
response = self.client.call('put', api_path, {
|
|
470
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
471
|
+
'content-type': 'application/json',
|
|
472
|
+
'accept': 'application/json',
|
|
473
|
+
}, api_params)
|
|
474
|
+
|
|
475
|
+
return self._parse_response(response, model=Database)
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
def delete(
|
|
479
|
+
self,
|
|
480
|
+
database_id: str
|
|
481
|
+
) -> Dict[str, Any]:
|
|
482
|
+
"""
|
|
483
|
+
Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
|
|
484
|
+
|
|
485
|
+
Parameters
|
|
486
|
+
----------
|
|
487
|
+
database_id : str
|
|
488
|
+
Database ID.
|
|
489
|
+
|
|
490
|
+
Returns
|
|
491
|
+
-------
|
|
492
|
+
Dict[str, Any]
|
|
493
|
+
API response as a dictionary
|
|
494
|
+
|
|
495
|
+
Raises
|
|
496
|
+
------
|
|
497
|
+
AppwriteException
|
|
498
|
+
If API request fails
|
|
499
|
+
"""
|
|
500
|
+
|
|
501
|
+
api_path = '/documentsdb/{databaseId}'
|
|
502
|
+
api_params = {}
|
|
503
|
+
if database_id is None:
|
|
504
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
505
|
+
|
|
506
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
response = self.client.call('delete', api_path, {
|
|
510
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
511
|
+
'content-type': 'application/json',
|
|
512
|
+
}, api_params)
|
|
513
|
+
|
|
514
|
+
return response
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
def list_collections(
|
|
518
|
+
self,
|
|
519
|
+
database_id: str,
|
|
520
|
+
queries: Optional[List[str]] = None,
|
|
521
|
+
search: Optional[str] = None,
|
|
522
|
+
total: Optional[bool] = None
|
|
523
|
+
) -> CollectionList:
|
|
524
|
+
"""
|
|
525
|
+
Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
|
|
526
|
+
|
|
527
|
+
Parameters
|
|
528
|
+
----------
|
|
529
|
+
database_id : str
|
|
530
|
+
Database ID.
|
|
531
|
+
queries : Optional[List[str]]
|
|
532
|
+
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, enabled, documentSecurity
|
|
533
|
+
search : Optional[str]
|
|
534
|
+
Search term to filter your list results. Max length: 256 chars.
|
|
535
|
+
total : Optional[bool]
|
|
536
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
537
|
+
|
|
538
|
+
Returns
|
|
539
|
+
-------
|
|
540
|
+
CollectionList
|
|
541
|
+
API response as a typed Pydantic model
|
|
542
|
+
|
|
543
|
+
Raises
|
|
544
|
+
------
|
|
545
|
+
AppwriteException
|
|
546
|
+
If API request fails
|
|
547
|
+
"""
|
|
548
|
+
|
|
549
|
+
api_path = '/documentsdb/{databaseId}/collections'
|
|
550
|
+
api_params = {}
|
|
551
|
+
if database_id is None:
|
|
552
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
553
|
+
|
|
554
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
555
|
+
|
|
556
|
+
if queries is not None:
|
|
557
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
558
|
+
if search is not None:
|
|
559
|
+
api_params['search'] = self._normalize_value(search)
|
|
560
|
+
if total is not None:
|
|
561
|
+
api_params['total'] = self._normalize_value(total)
|
|
562
|
+
|
|
563
|
+
response = self.client.call('get', api_path, {
|
|
564
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
565
|
+
'accept': 'application/json',
|
|
566
|
+
}, api_params)
|
|
567
|
+
|
|
568
|
+
return self._parse_response(response, model=CollectionList)
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
def create_collection(
|
|
572
|
+
self,
|
|
573
|
+
database_id: str,
|
|
574
|
+
collection_id: str,
|
|
575
|
+
name: str,
|
|
576
|
+
permissions: Optional[List[str]] = None,
|
|
577
|
+
document_security: Optional[bool] = None,
|
|
578
|
+
enabled: Optional[bool] = None,
|
|
579
|
+
attributes: Optional[List[Dict[str, Any]]] = None,
|
|
580
|
+
indexes: Optional[List[Dict[str, Any]]] = None
|
|
581
|
+
) -> Collection:
|
|
582
|
+
"""
|
|
583
|
+
Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
|
|
584
|
+
|
|
585
|
+
Parameters
|
|
586
|
+
----------
|
|
587
|
+
database_id : str
|
|
588
|
+
Database ID.
|
|
589
|
+
collection_id : str
|
|
590
|
+
Unique 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.
|
|
591
|
+
name : str
|
|
592
|
+
Collection name. Max length: 128 chars.
|
|
593
|
+
permissions : Optional[List[str]]
|
|
594
|
+
An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
595
|
+
document_security : Optional[bool]
|
|
596
|
+
Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
597
|
+
enabled : Optional[bool]
|
|
598
|
+
Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
|
|
599
|
+
attributes : Optional[List[Dict[str, Any]]]
|
|
600
|
+
Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
|
|
601
|
+
indexes : Optional[List[Dict[str, Any]]]
|
|
602
|
+
Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).
|
|
603
|
+
|
|
604
|
+
Returns
|
|
605
|
+
-------
|
|
606
|
+
Collection
|
|
607
|
+
API response as a typed Pydantic model
|
|
608
|
+
|
|
609
|
+
Raises
|
|
610
|
+
------
|
|
611
|
+
AppwriteException
|
|
612
|
+
If API request fails
|
|
613
|
+
"""
|
|
614
|
+
|
|
615
|
+
api_path = '/documentsdb/{databaseId}/collections'
|
|
616
|
+
api_params = {}
|
|
617
|
+
if database_id is None:
|
|
618
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
619
|
+
|
|
620
|
+
if collection_id is None:
|
|
621
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
622
|
+
|
|
623
|
+
if name is None:
|
|
624
|
+
raise AppwriteException('Missing required parameter: "name"')
|
|
625
|
+
|
|
626
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
627
|
+
|
|
628
|
+
api_params['collectionId'] = self._normalize_value(collection_id)
|
|
629
|
+
api_params['name'] = self._normalize_value(name)
|
|
630
|
+
if permissions is not None:
|
|
631
|
+
api_params['permissions'] = self._normalize_value(permissions)
|
|
632
|
+
if document_security is not None:
|
|
633
|
+
api_params['documentSecurity'] = self._normalize_value(document_security)
|
|
634
|
+
if enabled is not None:
|
|
635
|
+
api_params['enabled'] = self._normalize_value(enabled)
|
|
636
|
+
if attributes is not None:
|
|
637
|
+
api_params['attributes'] = self._normalize_value(attributes)
|
|
638
|
+
if indexes is not None:
|
|
639
|
+
api_params['indexes'] = self._normalize_value(indexes)
|
|
640
|
+
|
|
641
|
+
response = self.client.call('post', api_path, {
|
|
642
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
643
|
+
'content-type': 'application/json',
|
|
644
|
+
'accept': 'application/json',
|
|
645
|
+
}, api_params)
|
|
646
|
+
|
|
647
|
+
return self._parse_response(response, model=Collection)
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
def get_collection(
|
|
651
|
+
self,
|
|
652
|
+
database_id: str,
|
|
653
|
+
collection_id: str
|
|
654
|
+
) -> Collection:
|
|
655
|
+
"""
|
|
656
|
+
Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
|
|
657
|
+
|
|
658
|
+
Parameters
|
|
659
|
+
----------
|
|
660
|
+
database_id : str
|
|
661
|
+
Database ID.
|
|
662
|
+
collection_id : str
|
|
663
|
+
Collection ID.
|
|
664
|
+
|
|
665
|
+
Returns
|
|
666
|
+
-------
|
|
667
|
+
Collection
|
|
668
|
+
API response as a typed Pydantic model
|
|
669
|
+
|
|
670
|
+
Raises
|
|
671
|
+
------
|
|
672
|
+
AppwriteException
|
|
673
|
+
If API request fails
|
|
674
|
+
"""
|
|
675
|
+
|
|
676
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}'
|
|
677
|
+
api_params = {}
|
|
678
|
+
if database_id is None:
|
|
679
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
680
|
+
|
|
681
|
+
if collection_id is None:
|
|
682
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
683
|
+
|
|
684
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
685
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
response = self.client.call('get', api_path, {
|
|
689
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
690
|
+
'accept': 'application/json',
|
|
691
|
+
}, api_params)
|
|
692
|
+
|
|
693
|
+
return self._parse_response(response, model=Collection)
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
def update_collection(
|
|
697
|
+
self,
|
|
698
|
+
database_id: str,
|
|
699
|
+
collection_id: str,
|
|
700
|
+
name: str,
|
|
701
|
+
permissions: Optional[List[str]] = None,
|
|
702
|
+
document_security: Optional[bool] = None,
|
|
703
|
+
enabled: Optional[bool] = None,
|
|
704
|
+
purge: Optional[bool] = None
|
|
705
|
+
) -> Collection:
|
|
706
|
+
"""
|
|
707
|
+
Update a collection by its unique ID.
|
|
708
|
+
|
|
709
|
+
Parameters
|
|
710
|
+
----------
|
|
711
|
+
database_id : str
|
|
712
|
+
Database ID.
|
|
713
|
+
collection_id : str
|
|
714
|
+
Collection ID.
|
|
715
|
+
name : str
|
|
716
|
+
Collection name. Max length: 128 chars.
|
|
717
|
+
permissions : Optional[List[str]]
|
|
718
|
+
An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
719
|
+
document_security : Optional[bool]
|
|
720
|
+
Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
721
|
+
enabled : Optional[bool]
|
|
722
|
+
Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
|
|
723
|
+
purge : Optional[bool]
|
|
724
|
+
When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire.
|
|
725
|
+
|
|
726
|
+
Returns
|
|
727
|
+
-------
|
|
728
|
+
Collection
|
|
729
|
+
API response as a typed Pydantic model
|
|
730
|
+
|
|
731
|
+
Raises
|
|
732
|
+
------
|
|
733
|
+
AppwriteException
|
|
734
|
+
If API request fails
|
|
735
|
+
"""
|
|
736
|
+
|
|
737
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}'
|
|
738
|
+
api_params = {}
|
|
739
|
+
if database_id is None:
|
|
740
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
741
|
+
|
|
742
|
+
if collection_id is None:
|
|
743
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
744
|
+
|
|
745
|
+
if name is None:
|
|
746
|
+
raise AppwriteException('Missing required parameter: "name"')
|
|
747
|
+
|
|
748
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
749
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
750
|
+
|
|
751
|
+
api_params['name'] = self._normalize_value(name)
|
|
752
|
+
if permissions is not None:
|
|
753
|
+
api_params['permissions'] = self._normalize_value(permissions)
|
|
754
|
+
if document_security is not None:
|
|
755
|
+
api_params['documentSecurity'] = self._normalize_value(document_security)
|
|
756
|
+
if enabled is not None:
|
|
757
|
+
api_params['enabled'] = self._normalize_value(enabled)
|
|
758
|
+
if purge is not None:
|
|
759
|
+
api_params['purge'] = self._normalize_value(purge)
|
|
760
|
+
|
|
761
|
+
response = self.client.call('put', api_path, {
|
|
762
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
763
|
+
'content-type': 'application/json',
|
|
764
|
+
'accept': 'application/json',
|
|
765
|
+
}, api_params)
|
|
766
|
+
|
|
767
|
+
return self._parse_response(response, model=Collection)
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
def delete_collection(
|
|
771
|
+
self,
|
|
772
|
+
database_id: str,
|
|
773
|
+
collection_id: str
|
|
774
|
+
) -> Dict[str, Any]:
|
|
775
|
+
"""
|
|
776
|
+
Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
|
|
777
|
+
|
|
778
|
+
Parameters
|
|
779
|
+
----------
|
|
780
|
+
database_id : str
|
|
781
|
+
Database ID.
|
|
782
|
+
collection_id : str
|
|
783
|
+
Collection ID.
|
|
784
|
+
|
|
785
|
+
Returns
|
|
786
|
+
-------
|
|
787
|
+
Dict[str, Any]
|
|
788
|
+
API response as a dictionary
|
|
789
|
+
|
|
790
|
+
Raises
|
|
791
|
+
------
|
|
792
|
+
AppwriteException
|
|
793
|
+
If API request fails
|
|
794
|
+
"""
|
|
795
|
+
|
|
796
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}'
|
|
797
|
+
api_params = {}
|
|
798
|
+
if database_id is None:
|
|
799
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
800
|
+
|
|
801
|
+
if collection_id is None:
|
|
802
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
803
|
+
|
|
804
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
805
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
response = self.client.call('delete', api_path, {
|
|
809
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
810
|
+
'content-type': 'application/json',
|
|
811
|
+
}, api_params)
|
|
812
|
+
|
|
813
|
+
return response
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
def list_documents(
|
|
817
|
+
self,
|
|
818
|
+
database_id: str,
|
|
819
|
+
collection_id: str,
|
|
820
|
+
queries: Optional[List[str]] = None,
|
|
821
|
+
transaction_id: Optional[str] = None,
|
|
822
|
+
total: Optional[bool] = None,
|
|
823
|
+
ttl: Optional[float] = None,
|
|
824
|
+
model_type: Type[T] = dict
|
|
825
|
+
) -> DocumentList[T]:
|
|
826
|
+
"""
|
|
827
|
+
Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
|
|
828
|
+
|
|
829
|
+
Parameters
|
|
830
|
+
----------
|
|
831
|
+
database_id : str
|
|
832
|
+
Database ID.
|
|
833
|
+
collection_id : str
|
|
834
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
835
|
+
queries : Optional[List[str]]
|
|
836
|
+
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.
|
|
837
|
+
transaction_id : Optional[str]
|
|
838
|
+
Transaction ID to read uncommitted changes within the transaction.
|
|
839
|
+
total : Optional[bool]
|
|
840
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
841
|
+
ttl : Optional[float]
|
|
842
|
+
TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
|
|
843
|
+
|
|
844
|
+
model_type : Type[T], optional
|
|
845
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
846
|
+
|
|
847
|
+
Returns
|
|
848
|
+
-------
|
|
849
|
+
DocumentList[T]
|
|
850
|
+
API response as a typed Pydantic model
|
|
851
|
+
|
|
852
|
+
Raises
|
|
853
|
+
------
|
|
854
|
+
AppwriteException
|
|
855
|
+
If API request fails
|
|
856
|
+
"""
|
|
857
|
+
|
|
858
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
|
|
859
|
+
api_params = {}
|
|
860
|
+
if database_id is None:
|
|
861
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
862
|
+
|
|
863
|
+
if collection_id is None:
|
|
864
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
865
|
+
|
|
866
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
867
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
868
|
+
|
|
869
|
+
if queries is not None:
|
|
870
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
871
|
+
if transaction_id is not None:
|
|
872
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
873
|
+
if total is not None:
|
|
874
|
+
api_params['total'] = self._normalize_value(total)
|
|
875
|
+
if ttl is not None:
|
|
876
|
+
api_params['ttl'] = self._normalize_value(ttl)
|
|
877
|
+
|
|
878
|
+
response = self.client.call('get', api_path, {
|
|
879
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
880
|
+
'accept': 'application/json',
|
|
881
|
+
}, api_params)
|
|
882
|
+
|
|
883
|
+
return DocumentList.with_data(response, model_type)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
def create_document(
|
|
887
|
+
self,
|
|
888
|
+
database_id: str,
|
|
889
|
+
collection_id: str,
|
|
890
|
+
document_id: str,
|
|
891
|
+
data: Dict[str, Any],
|
|
892
|
+
permissions: Optional[List[str]] = None,
|
|
893
|
+
model_type: Type[T] = dict
|
|
894
|
+
) -> Document[T]:
|
|
895
|
+
"""
|
|
896
|
+
Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
|
|
897
|
+
|
|
898
|
+
Parameters
|
|
899
|
+
----------
|
|
900
|
+
database_id : str
|
|
901
|
+
Database ID.
|
|
902
|
+
collection_id : str
|
|
903
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
904
|
+
document_id : str
|
|
905
|
+
Document 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.
|
|
906
|
+
data : Dict[str, Any]
|
|
907
|
+
Document data as JSON object.
|
|
908
|
+
permissions : Optional[List[str]]
|
|
909
|
+
An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
910
|
+
|
|
911
|
+
model_type : Type[T], optional
|
|
912
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
913
|
+
|
|
914
|
+
Returns
|
|
915
|
+
-------
|
|
916
|
+
Document[T]
|
|
917
|
+
API response as a typed Pydantic model
|
|
918
|
+
|
|
919
|
+
Raises
|
|
920
|
+
------
|
|
921
|
+
AppwriteException
|
|
922
|
+
If API request fails
|
|
923
|
+
"""
|
|
924
|
+
|
|
925
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
|
|
926
|
+
api_params = {}
|
|
927
|
+
if database_id is None:
|
|
928
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
929
|
+
|
|
930
|
+
if collection_id is None:
|
|
931
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
932
|
+
|
|
933
|
+
if document_id is None:
|
|
934
|
+
raise AppwriteException('Missing required parameter: "document_id"')
|
|
935
|
+
|
|
936
|
+
if data is None:
|
|
937
|
+
raise AppwriteException('Missing required parameter: "data"')
|
|
938
|
+
|
|
939
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
940
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
941
|
+
|
|
942
|
+
api_params['documentId'] = self._normalize_value(document_id)
|
|
943
|
+
api_params['data'] = self._normalize_value(data)
|
|
944
|
+
if permissions is not None:
|
|
945
|
+
api_params['permissions'] = self._normalize_value(permissions)
|
|
946
|
+
|
|
947
|
+
response = self.client.call('post', api_path, {
|
|
948
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
949
|
+
'content-type': 'application/json',
|
|
950
|
+
'accept': 'application/json',
|
|
951
|
+
}, api_params)
|
|
952
|
+
|
|
953
|
+
return Document.with_data(response, model_type)
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
def create_documents(
|
|
957
|
+
self,
|
|
958
|
+
database_id: str,
|
|
959
|
+
collection_id: str,
|
|
960
|
+
documents: List[Dict[str, Any]],
|
|
961
|
+
model_type: Type[T] = dict
|
|
962
|
+
) -> DocumentList[T]:
|
|
963
|
+
"""
|
|
964
|
+
Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
|
|
965
|
+
|
|
966
|
+
Parameters
|
|
967
|
+
----------
|
|
968
|
+
database_id : str
|
|
969
|
+
Database ID.
|
|
970
|
+
collection_id : str
|
|
971
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
|
|
972
|
+
documents : List[Dict[str, Any]]
|
|
973
|
+
Array of documents data as JSON objects.
|
|
974
|
+
|
|
975
|
+
model_type : Type[T], optional
|
|
976
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
977
|
+
|
|
978
|
+
Returns
|
|
979
|
+
-------
|
|
980
|
+
DocumentList[T]
|
|
981
|
+
API response as a typed Pydantic model
|
|
982
|
+
|
|
983
|
+
Raises
|
|
984
|
+
------
|
|
985
|
+
AppwriteException
|
|
986
|
+
If API request fails
|
|
987
|
+
"""
|
|
988
|
+
|
|
989
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
|
|
990
|
+
api_params = {}
|
|
991
|
+
if database_id is None:
|
|
992
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
993
|
+
|
|
994
|
+
if collection_id is None:
|
|
995
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
996
|
+
|
|
997
|
+
if documents is None:
|
|
998
|
+
raise AppwriteException('Missing required parameter: "documents"')
|
|
999
|
+
|
|
1000
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1001
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1002
|
+
|
|
1003
|
+
api_params['documents'] = self._normalize_value(documents)
|
|
1004
|
+
|
|
1005
|
+
response = self.client.call('post', api_path, {
|
|
1006
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1007
|
+
'content-type': 'application/json',
|
|
1008
|
+
'accept': 'application/json',
|
|
1009
|
+
}, api_params)
|
|
1010
|
+
|
|
1011
|
+
return DocumentList.with_data(response, model_type)
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
def upsert_documents(
|
|
1015
|
+
self,
|
|
1016
|
+
database_id: str,
|
|
1017
|
+
collection_id: str,
|
|
1018
|
+
documents: List[Dict[str, Any]],
|
|
1019
|
+
transaction_id: Optional[str] = None,
|
|
1020
|
+
model_type: Type[T] = dict
|
|
1021
|
+
) -> DocumentList[T]:
|
|
1022
|
+
"""
|
|
1023
|
+
Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
Parameters
|
|
1027
|
+
----------
|
|
1028
|
+
database_id : str
|
|
1029
|
+
Database ID.
|
|
1030
|
+
collection_id : str
|
|
1031
|
+
Collection ID.
|
|
1032
|
+
documents : List[Dict[str, Any]]
|
|
1033
|
+
Array of document data as JSON objects. May contain partial documents.
|
|
1034
|
+
transaction_id : Optional[str]
|
|
1035
|
+
Transaction ID for staging the operation.
|
|
1036
|
+
|
|
1037
|
+
model_type : Type[T], optional
|
|
1038
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1039
|
+
|
|
1040
|
+
Returns
|
|
1041
|
+
-------
|
|
1042
|
+
DocumentList[T]
|
|
1043
|
+
API response as a typed Pydantic model
|
|
1044
|
+
|
|
1045
|
+
Raises
|
|
1046
|
+
------
|
|
1047
|
+
AppwriteException
|
|
1048
|
+
If API request fails
|
|
1049
|
+
"""
|
|
1050
|
+
|
|
1051
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
|
|
1052
|
+
api_params = {}
|
|
1053
|
+
if database_id is None:
|
|
1054
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1055
|
+
|
|
1056
|
+
if collection_id is None:
|
|
1057
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1058
|
+
|
|
1059
|
+
if documents is None:
|
|
1060
|
+
raise AppwriteException('Missing required parameter: "documents"')
|
|
1061
|
+
|
|
1062
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1063
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1064
|
+
|
|
1065
|
+
api_params['documents'] = self._normalize_value(documents)
|
|
1066
|
+
if transaction_id is not None:
|
|
1067
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
1068
|
+
|
|
1069
|
+
response = self.client.call('put', api_path, {
|
|
1070
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1071
|
+
'content-type': 'application/json',
|
|
1072
|
+
'accept': 'application/json',
|
|
1073
|
+
}, api_params)
|
|
1074
|
+
|
|
1075
|
+
return DocumentList.with_data(response, model_type)
|
|
1076
|
+
|
|
1077
|
+
|
|
1078
|
+
def update_documents(
|
|
1079
|
+
self,
|
|
1080
|
+
database_id: str,
|
|
1081
|
+
collection_id: str,
|
|
1082
|
+
data: Optional[Dict[str, Any]] = None,
|
|
1083
|
+
queries: Optional[List[str]] = None,
|
|
1084
|
+
transaction_id: Optional[str] = None,
|
|
1085
|
+
model_type: Type[T] = dict
|
|
1086
|
+
) -> DocumentList[T]:
|
|
1087
|
+
"""
|
|
1088
|
+
Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.
|
|
1089
|
+
|
|
1090
|
+
Parameters
|
|
1091
|
+
----------
|
|
1092
|
+
database_id : str
|
|
1093
|
+
Database ID.
|
|
1094
|
+
collection_id : str
|
|
1095
|
+
Collection ID.
|
|
1096
|
+
data : Optional[Dict[str, Any]]
|
|
1097
|
+
Document data as JSON object. Include only attribute and value pairs to be updated.
|
|
1098
|
+
queries : Optional[List[str]]
|
|
1099
|
+
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.
|
|
1100
|
+
transaction_id : Optional[str]
|
|
1101
|
+
Transaction ID for staging the operation.
|
|
1102
|
+
|
|
1103
|
+
model_type : Type[T], optional
|
|
1104
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1105
|
+
|
|
1106
|
+
Returns
|
|
1107
|
+
-------
|
|
1108
|
+
DocumentList[T]
|
|
1109
|
+
API response as a typed Pydantic model
|
|
1110
|
+
|
|
1111
|
+
Raises
|
|
1112
|
+
------
|
|
1113
|
+
AppwriteException
|
|
1114
|
+
If API request fails
|
|
1115
|
+
"""
|
|
1116
|
+
|
|
1117
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
|
|
1118
|
+
api_params = {}
|
|
1119
|
+
if database_id is None:
|
|
1120
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1121
|
+
|
|
1122
|
+
if collection_id is None:
|
|
1123
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1124
|
+
|
|
1125
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1126
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1127
|
+
|
|
1128
|
+
if data is not None:
|
|
1129
|
+
api_params['data'] = self._normalize_value(data)
|
|
1130
|
+
if queries is not None:
|
|
1131
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
1132
|
+
if transaction_id is not None:
|
|
1133
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
1134
|
+
|
|
1135
|
+
response = self.client.call('patch', api_path, {
|
|
1136
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1137
|
+
'content-type': 'application/json',
|
|
1138
|
+
'accept': 'application/json',
|
|
1139
|
+
}, api_params)
|
|
1140
|
+
|
|
1141
|
+
return DocumentList.with_data(response, model_type)
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
def delete_documents(
|
|
1145
|
+
self,
|
|
1146
|
+
database_id: str,
|
|
1147
|
+
collection_id: str,
|
|
1148
|
+
queries: Optional[List[str]] = None,
|
|
1149
|
+
transaction_id: Optional[str] = None,
|
|
1150
|
+
model_type: Type[T] = dict
|
|
1151
|
+
) -> DocumentList[T]:
|
|
1152
|
+
"""
|
|
1153
|
+
Bulk delete documents using queries, if no queries are passed then all documents are deleted.
|
|
1154
|
+
|
|
1155
|
+
Parameters
|
|
1156
|
+
----------
|
|
1157
|
+
database_id : str
|
|
1158
|
+
Database ID.
|
|
1159
|
+
collection_id : str
|
|
1160
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1161
|
+
queries : Optional[List[str]]
|
|
1162
|
+
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.
|
|
1163
|
+
transaction_id : Optional[str]
|
|
1164
|
+
Transaction ID for staging the operation.
|
|
1165
|
+
|
|
1166
|
+
model_type : Type[T], optional
|
|
1167
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1168
|
+
|
|
1169
|
+
Returns
|
|
1170
|
+
-------
|
|
1171
|
+
DocumentList[T]
|
|
1172
|
+
API response as a typed Pydantic model
|
|
1173
|
+
|
|
1174
|
+
Raises
|
|
1175
|
+
------
|
|
1176
|
+
AppwriteException
|
|
1177
|
+
If API request fails
|
|
1178
|
+
"""
|
|
1179
|
+
|
|
1180
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
|
|
1181
|
+
api_params = {}
|
|
1182
|
+
if database_id is None:
|
|
1183
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1184
|
+
|
|
1185
|
+
if collection_id is None:
|
|
1186
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1187
|
+
|
|
1188
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1189
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1190
|
+
|
|
1191
|
+
if queries is not None:
|
|
1192
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
1193
|
+
if transaction_id is not None:
|
|
1194
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
1195
|
+
|
|
1196
|
+
response = self.client.call('delete', api_path, {
|
|
1197
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1198
|
+
'content-type': 'application/json',
|
|
1199
|
+
'accept': 'application/json',
|
|
1200
|
+
}, api_params)
|
|
1201
|
+
|
|
1202
|
+
return DocumentList.with_data(response, model_type)
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
def get_document(
|
|
1206
|
+
self,
|
|
1207
|
+
database_id: str,
|
|
1208
|
+
collection_id: str,
|
|
1209
|
+
document_id: str,
|
|
1210
|
+
queries: Optional[List[str]] = None,
|
|
1211
|
+
transaction_id: Optional[str] = None,
|
|
1212
|
+
model_type: Type[T] = dict
|
|
1213
|
+
) -> Document[T]:
|
|
1214
|
+
"""
|
|
1215
|
+
Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
|
|
1216
|
+
|
|
1217
|
+
Parameters
|
|
1218
|
+
----------
|
|
1219
|
+
database_id : str
|
|
1220
|
+
Database ID.
|
|
1221
|
+
collection_id : str
|
|
1222
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1223
|
+
document_id : str
|
|
1224
|
+
Document ID.
|
|
1225
|
+
queries : Optional[List[str]]
|
|
1226
|
+
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.
|
|
1227
|
+
transaction_id : Optional[str]
|
|
1228
|
+
Transaction ID to read uncommitted changes within the transaction.
|
|
1229
|
+
|
|
1230
|
+
model_type : Type[T], optional
|
|
1231
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1232
|
+
|
|
1233
|
+
Returns
|
|
1234
|
+
-------
|
|
1235
|
+
Document[T]
|
|
1236
|
+
API response as a typed Pydantic model
|
|
1237
|
+
|
|
1238
|
+
Raises
|
|
1239
|
+
------
|
|
1240
|
+
AppwriteException
|
|
1241
|
+
If API request fails
|
|
1242
|
+
"""
|
|
1243
|
+
|
|
1244
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
|
1245
|
+
api_params = {}
|
|
1246
|
+
if database_id is None:
|
|
1247
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1248
|
+
|
|
1249
|
+
if collection_id is None:
|
|
1250
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1251
|
+
|
|
1252
|
+
if document_id is None:
|
|
1253
|
+
raise AppwriteException('Missing required parameter: "document_id"')
|
|
1254
|
+
|
|
1255
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1256
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1257
|
+
api_path = api_path.replace('{documentId}', str(self._normalize_value(document_id)))
|
|
1258
|
+
|
|
1259
|
+
if queries is not None:
|
|
1260
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
1261
|
+
if transaction_id is not None:
|
|
1262
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
1263
|
+
|
|
1264
|
+
response = self.client.call('get', api_path, {
|
|
1265
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1266
|
+
'accept': 'application/json',
|
|
1267
|
+
}, api_params)
|
|
1268
|
+
|
|
1269
|
+
return Document.with_data(response, model_type)
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
def upsert_document(
|
|
1273
|
+
self,
|
|
1274
|
+
database_id: str,
|
|
1275
|
+
collection_id: str,
|
|
1276
|
+
document_id: str,
|
|
1277
|
+
data: Optional[Dict[str, Any]] = None,
|
|
1278
|
+
permissions: Optional[List[str]] = None,
|
|
1279
|
+
transaction_id: Optional[str] = None,
|
|
1280
|
+
model_type: Type[T] = dict
|
|
1281
|
+
) -> Document[T]:
|
|
1282
|
+
"""
|
|
1283
|
+
Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
|
|
1284
|
+
|
|
1285
|
+
Parameters
|
|
1286
|
+
----------
|
|
1287
|
+
database_id : str
|
|
1288
|
+
Database ID.
|
|
1289
|
+
collection_id : str
|
|
1290
|
+
Collection ID.
|
|
1291
|
+
document_id : str
|
|
1292
|
+
Document ID.
|
|
1293
|
+
data : Optional[Dict[str, Any]]
|
|
1294
|
+
Document data as JSON object. Include all required fields of the document to be created or updated.
|
|
1295
|
+
permissions : Optional[List[str]]
|
|
1296
|
+
An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1297
|
+
transaction_id : Optional[str]
|
|
1298
|
+
Transaction ID for staging the operation.
|
|
1299
|
+
|
|
1300
|
+
model_type : Type[T], optional
|
|
1301
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1302
|
+
|
|
1303
|
+
Returns
|
|
1304
|
+
-------
|
|
1305
|
+
Document[T]
|
|
1306
|
+
API response as a typed Pydantic model
|
|
1307
|
+
|
|
1308
|
+
Raises
|
|
1309
|
+
------
|
|
1310
|
+
AppwriteException
|
|
1311
|
+
If API request fails
|
|
1312
|
+
"""
|
|
1313
|
+
|
|
1314
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
|
1315
|
+
api_params = {}
|
|
1316
|
+
if database_id is None:
|
|
1317
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1318
|
+
|
|
1319
|
+
if collection_id is None:
|
|
1320
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1321
|
+
|
|
1322
|
+
if document_id is None:
|
|
1323
|
+
raise AppwriteException('Missing required parameter: "document_id"')
|
|
1324
|
+
|
|
1325
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1326
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1327
|
+
api_path = api_path.replace('{documentId}', str(self._normalize_value(document_id)))
|
|
1328
|
+
|
|
1329
|
+
if data is not None:
|
|
1330
|
+
api_params['data'] = self._normalize_value(data)
|
|
1331
|
+
if permissions is not None:
|
|
1332
|
+
api_params['permissions'] = self._normalize_value(permissions)
|
|
1333
|
+
if transaction_id is not None:
|
|
1334
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
1335
|
+
|
|
1336
|
+
response = self.client.call('put', api_path, {
|
|
1337
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1338
|
+
'content-type': 'application/json',
|
|
1339
|
+
'accept': 'application/json',
|
|
1340
|
+
}, api_params)
|
|
1341
|
+
|
|
1342
|
+
return Document.with_data(response, model_type)
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
def update_document(
|
|
1346
|
+
self,
|
|
1347
|
+
database_id: str,
|
|
1348
|
+
collection_id: str,
|
|
1349
|
+
document_id: str,
|
|
1350
|
+
data: Optional[Dict[str, Any]] = None,
|
|
1351
|
+
permissions: Optional[List[str]] = None,
|
|
1352
|
+
transaction_id: Optional[str] = None,
|
|
1353
|
+
model_type: Type[T] = dict
|
|
1354
|
+
) -> Document[T]:
|
|
1355
|
+
"""
|
|
1356
|
+
Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
|
1357
|
+
|
|
1358
|
+
Parameters
|
|
1359
|
+
----------
|
|
1360
|
+
database_id : str
|
|
1361
|
+
Database ID.
|
|
1362
|
+
collection_id : str
|
|
1363
|
+
Collection ID.
|
|
1364
|
+
document_id : str
|
|
1365
|
+
Document ID.
|
|
1366
|
+
data : Optional[Dict[str, Any]]
|
|
1367
|
+
Document data as JSON object. Include only fields and value pairs to be updated.
|
|
1368
|
+
permissions : Optional[List[str]]
|
|
1369
|
+
An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
1370
|
+
transaction_id : Optional[str]
|
|
1371
|
+
Transaction ID for staging the operation.
|
|
1372
|
+
|
|
1373
|
+
model_type : Type[T], optional
|
|
1374
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1375
|
+
|
|
1376
|
+
Returns
|
|
1377
|
+
-------
|
|
1378
|
+
Document[T]
|
|
1379
|
+
API response as a typed Pydantic model
|
|
1380
|
+
|
|
1381
|
+
Raises
|
|
1382
|
+
------
|
|
1383
|
+
AppwriteException
|
|
1384
|
+
If API request fails
|
|
1385
|
+
"""
|
|
1386
|
+
|
|
1387
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
|
1388
|
+
api_params = {}
|
|
1389
|
+
if database_id is None:
|
|
1390
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1391
|
+
|
|
1392
|
+
if collection_id is None:
|
|
1393
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1394
|
+
|
|
1395
|
+
if document_id is None:
|
|
1396
|
+
raise AppwriteException('Missing required parameter: "document_id"')
|
|
1397
|
+
|
|
1398
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1399
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1400
|
+
api_path = api_path.replace('{documentId}', str(self._normalize_value(document_id)))
|
|
1401
|
+
|
|
1402
|
+
if data is not None:
|
|
1403
|
+
api_params['data'] = self._normalize_value(data)
|
|
1404
|
+
if permissions is not None:
|
|
1405
|
+
api_params['permissions'] = self._normalize_value(permissions)
|
|
1406
|
+
if transaction_id is not None:
|
|
1407
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
1408
|
+
|
|
1409
|
+
response = self.client.call('patch', api_path, {
|
|
1410
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1411
|
+
'content-type': 'application/json',
|
|
1412
|
+
'accept': 'application/json',
|
|
1413
|
+
}, api_params)
|
|
1414
|
+
|
|
1415
|
+
return Document.with_data(response, model_type)
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
def delete_document(
|
|
1419
|
+
self,
|
|
1420
|
+
database_id: str,
|
|
1421
|
+
collection_id: str,
|
|
1422
|
+
document_id: str,
|
|
1423
|
+
transaction_id: Optional[str] = None
|
|
1424
|
+
) -> Dict[str, Any]:
|
|
1425
|
+
"""
|
|
1426
|
+
Delete a document by its unique ID.
|
|
1427
|
+
|
|
1428
|
+
Parameters
|
|
1429
|
+
----------
|
|
1430
|
+
database_id : str
|
|
1431
|
+
Database ID.
|
|
1432
|
+
collection_id : str
|
|
1433
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1434
|
+
document_id : str
|
|
1435
|
+
Document ID.
|
|
1436
|
+
transaction_id : Optional[str]
|
|
1437
|
+
Transaction ID for staging the operation.
|
|
1438
|
+
|
|
1439
|
+
Returns
|
|
1440
|
+
-------
|
|
1441
|
+
Dict[str, Any]
|
|
1442
|
+
API response as a dictionary
|
|
1443
|
+
|
|
1444
|
+
Raises
|
|
1445
|
+
------
|
|
1446
|
+
AppwriteException
|
|
1447
|
+
If API request fails
|
|
1448
|
+
"""
|
|
1449
|
+
|
|
1450
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
|
1451
|
+
api_params = {}
|
|
1452
|
+
if database_id is None:
|
|
1453
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1454
|
+
|
|
1455
|
+
if collection_id is None:
|
|
1456
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1457
|
+
|
|
1458
|
+
if document_id is None:
|
|
1459
|
+
raise AppwriteException('Missing required parameter: "document_id"')
|
|
1460
|
+
|
|
1461
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1462
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1463
|
+
api_path = api_path.replace('{documentId}', str(self._normalize_value(document_id)))
|
|
1464
|
+
|
|
1465
|
+
if transaction_id is not None:
|
|
1466
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
1467
|
+
|
|
1468
|
+
response = self.client.call('delete', api_path, {
|
|
1469
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1470
|
+
'content-type': 'application/json',
|
|
1471
|
+
}, api_params)
|
|
1472
|
+
|
|
1473
|
+
return response
|
|
1474
|
+
|
|
1475
|
+
|
|
1476
|
+
def decrement_document_attribute(
|
|
1477
|
+
self,
|
|
1478
|
+
database_id: str,
|
|
1479
|
+
collection_id: str,
|
|
1480
|
+
document_id: str,
|
|
1481
|
+
attribute: str,
|
|
1482
|
+
value: Optional[float] = None,
|
|
1483
|
+
min: Optional[float] = None,
|
|
1484
|
+
transaction_id: Optional[str] = None,
|
|
1485
|
+
model_type: Type[T] = dict
|
|
1486
|
+
) -> Document[T]:
|
|
1487
|
+
"""
|
|
1488
|
+
Decrement a specific column of a row by a given value.
|
|
1489
|
+
|
|
1490
|
+
Parameters
|
|
1491
|
+
----------
|
|
1492
|
+
database_id : str
|
|
1493
|
+
Database ID.
|
|
1494
|
+
collection_id : str
|
|
1495
|
+
Collection ID.
|
|
1496
|
+
document_id : str
|
|
1497
|
+
Document ID.
|
|
1498
|
+
attribute : str
|
|
1499
|
+
Attribute key.
|
|
1500
|
+
value : Optional[float]
|
|
1501
|
+
Value to decrement the attribute by. The value must be a number.
|
|
1502
|
+
min : Optional[float]
|
|
1503
|
+
Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
|
|
1504
|
+
transaction_id : Optional[str]
|
|
1505
|
+
Transaction ID for staging the operation.
|
|
1506
|
+
|
|
1507
|
+
model_type : Type[T], optional
|
|
1508
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1509
|
+
|
|
1510
|
+
Returns
|
|
1511
|
+
-------
|
|
1512
|
+
Document[T]
|
|
1513
|
+
API response as a typed Pydantic model
|
|
1514
|
+
|
|
1515
|
+
Raises
|
|
1516
|
+
------
|
|
1517
|
+
AppwriteException
|
|
1518
|
+
If API request fails
|
|
1519
|
+
"""
|
|
1520
|
+
|
|
1521
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'
|
|
1522
|
+
api_params = {}
|
|
1523
|
+
if database_id is None:
|
|
1524
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1525
|
+
|
|
1526
|
+
if collection_id is None:
|
|
1527
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1528
|
+
|
|
1529
|
+
if document_id is None:
|
|
1530
|
+
raise AppwriteException('Missing required parameter: "document_id"')
|
|
1531
|
+
|
|
1532
|
+
if attribute is None:
|
|
1533
|
+
raise AppwriteException('Missing required parameter: "attribute"')
|
|
1534
|
+
|
|
1535
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1536
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1537
|
+
api_path = api_path.replace('{documentId}', str(self._normalize_value(document_id)))
|
|
1538
|
+
api_path = api_path.replace('{attribute}', str(self._normalize_value(attribute)))
|
|
1539
|
+
|
|
1540
|
+
if value is not None:
|
|
1541
|
+
api_params['value'] = self._normalize_value(value)
|
|
1542
|
+
if min is not None:
|
|
1543
|
+
api_params['min'] = self._normalize_value(min)
|
|
1544
|
+
if transaction_id is not None:
|
|
1545
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
1546
|
+
|
|
1547
|
+
response = self.client.call('patch', api_path, {
|
|
1548
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1549
|
+
'content-type': 'application/json',
|
|
1550
|
+
'accept': 'application/json',
|
|
1551
|
+
}, api_params)
|
|
1552
|
+
|
|
1553
|
+
return Document.with_data(response, model_type)
|
|
1554
|
+
|
|
1555
|
+
|
|
1556
|
+
def increment_document_attribute(
|
|
1557
|
+
self,
|
|
1558
|
+
database_id: str,
|
|
1559
|
+
collection_id: str,
|
|
1560
|
+
document_id: str,
|
|
1561
|
+
attribute: str,
|
|
1562
|
+
value: Optional[float] = None,
|
|
1563
|
+
max: Optional[float] = None,
|
|
1564
|
+
transaction_id: Optional[str] = None,
|
|
1565
|
+
model_type: Type[T] = dict
|
|
1566
|
+
) -> Document[T]:
|
|
1567
|
+
"""
|
|
1568
|
+
Increment a specific column of a row by a given value.
|
|
1569
|
+
|
|
1570
|
+
Parameters
|
|
1571
|
+
----------
|
|
1572
|
+
database_id : str
|
|
1573
|
+
Database ID.
|
|
1574
|
+
collection_id : str
|
|
1575
|
+
Collection ID.
|
|
1576
|
+
document_id : str
|
|
1577
|
+
Document ID.
|
|
1578
|
+
attribute : str
|
|
1579
|
+
Attribute key.
|
|
1580
|
+
value : Optional[float]
|
|
1581
|
+
Value to increment the attribute by. The value must be a number.
|
|
1582
|
+
max : Optional[float]
|
|
1583
|
+
Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
|
|
1584
|
+
transaction_id : Optional[str]
|
|
1585
|
+
Transaction ID for staging the operation.
|
|
1586
|
+
|
|
1587
|
+
model_type : Type[T], optional
|
|
1588
|
+
Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
|
|
1589
|
+
|
|
1590
|
+
Returns
|
|
1591
|
+
-------
|
|
1592
|
+
Document[T]
|
|
1593
|
+
API response as a typed Pydantic model
|
|
1594
|
+
|
|
1595
|
+
Raises
|
|
1596
|
+
------
|
|
1597
|
+
AppwriteException
|
|
1598
|
+
If API request fails
|
|
1599
|
+
"""
|
|
1600
|
+
|
|
1601
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'
|
|
1602
|
+
api_params = {}
|
|
1603
|
+
if database_id is None:
|
|
1604
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1605
|
+
|
|
1606
|
+
if collection_id is None:
|
|
1607
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1608
|
+
|
|
1609
|
+
if document_id is None:
|
|
1610
|
+
raise AppwriteException('Missing required parameter: "document_id"')
|
|
1611
|
+
|
|
1612
|
+
if attribute is None:
|
|
1613
|
+
raise AppwriteException('Missing required parameter: "attribute"')
|
|
1614
|
+
|
|
1615
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1616
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1617
|
+
api_path = api_path.replace('{documentId}', str(self._normalize_value(document_id)))
|
|
1618
|
+
api_path = api_path.replace('{attribute}', str(self._normalize_value(attribute)))
|
|
1619
|
+
|
|
1620
|
+
if value is not None:
|
|
1621
|
+
api_params['value'] = self._normalize_value(value)
|
|
1622
|
+
if max is not None:
|
|
1623
|
+
api_params['max'] = self._normalize_value(max)
|
|
1624
|
+
if transaction_id is not None:
|
|
1625
|
+
api_params['transactionId'] = self._normalize_value(transaction_id)
|
|
1626
|
+
|
|
1627
|
+
response = self.client.call('patch', api_path, {
|
|
1628
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1629
|
+
'content-type': 'application/json',
|
|
1630
|
+
'accept': 'application/json',
|
|
1631
|
+
}, api_params)
|
|
1632
|
+
|
|
1633
|
+
return Document.with_data(response, model_type)
|
|
1634
|
+
|
|
1635
|
+
|
|
1636
|
+
def list_indexes(
|
|
1637
|
+
self,
|
|
1638
|
+
database_id: str,
|
|
1639
|
+
collection_id: str,
|
|
1640
|
+
queries: Optional[List[str]] = None,
|
|
1641
|
+
total: Optional[bool] = None
|
|
1642
|
+
) -> IndexList:
|
|
1643
|
+
"""
|
|
1644
|
+
List indexes in the collection.
|
|
1645
|
+
|
|
1646
|
+
Parameters
|
|
1647
|
+
----------
|
|
1648
|
+
database_id : str
|
|
1649
|
+
Database ID.
|
|
1650
|
+
collection_id : str
|
|
1651
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1652
|
+
queries : Optional[List[str]]
|
|
1653
|
+
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: key, type, status, attributes, error
|
|
1654
|
+
total : Optional[bool]
|
|
1655
|
+
When set to false, the total count returned will be 0 and will not be calculated.
|
|
1656
|
+
|
|
1657
|
+
Returns
|
|
1658
|
+
-------
|
|
1659
|
+
IndexList
|
|
1660
|
+
API response as a typed Pydantic model
|
|
1661
|
+
|
|
1662
|
+
Raises
|
|
1663
|
+
------
|
|
1664
|
+
AppwriteException
|
|
1665
|
+
If API request fails
|
|
1666
|
+
"""
|
|
1667
|
+
|
|
1668
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes'
|
|
1669
|
+
api_params = {}
|
|
1670
|
+
if database_id is None:
|
|
1671
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1672
|
+
|
|
1673
|
+
if collection_id is None:
|
|
1674
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1675
|
+
|
|
1676
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1677
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1678
|
+
|
|
1679
|
+
if queries is not None:
|
|
1680
|
+
api_params['queries'] = self._normalize_value(queries)
|
|
1681
|
+
if total is not None:
|
|
1682
|
+
api_params['total'] = self._normalize_value(total)
|
|
1683
|
+
|
|
1684
|
+
response = self.client.call('get', api_path, {
|
|
1685
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1686
|
+
'accept': 'application/json',
|
|
1687
|
+
}, api_params)
|
|
1688
|
+
|
|
1689
|
+
return self._parse_response(response, model=IndexList)
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
def create_index(
|
|
1693
|
+
self,
|
|
1694
|
+
database_id: str,
|
|
1695
|
+
collection_id: str,
|
|
1696
|
+
key: str,
|
|
1697
|
+
type: DocumentsDBIndexType,
|
|
1698
|
+
attributes: List[str],
|
|
1699
|
+
orders: Optional[List[OrderBy]] = None,
|
|
1700
|
+
lengths: Optional[List[float]] = None
|
|
1701
|
+
) -> Index:
|
|
1702
|
+
"""
|
|
1703
|
+
Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.
|
|
1704
|
+
Attributes can be `key`, `fulltext`, and `unique`.
|
|
1705
|
+
|
|
1706
|
+
Parameters
|
|
1707
|
+
----------
|
|
1708
|
+
database_id : str
|
|
1709
|
+
Database ID.
|
|
1710
|
+
collection_id : str
|
|
1711
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1712
|
+
key : str
|
|
1713
|
+
Index Key.
|
|
1714
|
+
type : DocumentsDBIndexType
|
|
1715
|
+
Index type.
|
|
1716
|
+
attributes : List[str]
|
|
1717
|
+
Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
|
|
1718
|
+
orders : Optional[List[OrderBy]]
|
|
1719
|
+
Array of index orders. Maximum of 100 orders are allowed.
|
|
1720
|
+
lengths : Optional[List[float]]
|
|
1721
|
+
Length of index. Maximum of 100
|
|
1722
|
+
|
|
1723
|
+
Returns
|
|
1724
|
+
-------
|
|
1725
|
+
Index
|
|
1726
|
+
API response as a typed Pydantic model
|
|
1727
|
+
|
|
1728
|
+
Raises
|
|
1729
|
+
------
|
|
1730
|
+
AppwriteException
|
|
1731
|
+
If API request fails
|
|
1732
|
+
"""
|
|
1733
|
+
|
|
1734
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes'
|
|
1735
|
+
api_params = {}
|
|
1736
|
+
if database_id is None:
|
|
1737
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1738
|
+
|
|
1739
|
+
if collection_id is None:
|
|
1740
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1741
|
+
|
|
1742
|
+
if key is None:
|
|
1743
|
+
raise AppwriteException('Missing required parameter: "key"')
|
|
1744
|
+
|
|
1745
|
+
if type is None:
|
|
1746
|
+
raise AppwriteException('Missing required parameter: "type"')
|
|
1747
|
+
|
|
1748
|
+
if attributes is None:
|
|
1749
|
+
raise AppwriteException('Missing required parameter: "attributes"')
|
|
1750
|
+
|
|
1751
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1752
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1753
|
+
|
|
1754
|
+
api_params['key'] = self._normalize_value(key)
|
|
1755
|
+
api_params['type'] = self._normalize_value(type)
|
|
1756
|
+
api_params['attributes'] = self._normalize_value(attributes)
|
|
1757
|
+
if orders is not None:
|
|
1758
|
+
api_params['orders'] = self._normalize_value(orders)
|
|
1759
|
+
if lengths is not None:
|
|
1760
|
+
api_params['lengths'] = self._normalize_value(lengths)
|
|
1761
|
+
|
|
1762
|
+
response = self.client.call('post', api_path, {
|
|
1763
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1764
|
+
'content-type': 'application/json',
|
|
1765
|
+
'accept': 'application/json',
|
|
1766
|
+
}, api_params)
|
|
1767
|
+
|
|
1768
|
+
return self._parse_response(response, model=Index)
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
def get_index(
|
|
1772
|
+
self,
|
|
1773
|
+
database_id: str,
|
|
1774
|
+
collection_id: str,
|
|
1775
|
+
key: str
|
|
1776
|
+
) -> Index:
|
|
1777
|
+
"""
|
|
1778
|
+
Get index by ID.
|
|
1779
|
+
|
|
1780
|
+
Parameters
|
|
1781
|
+
----------
|
|
1782
|
+
database_id : str
|
|
1783
|
+
Database ID.
|
|
1784
|
+
collection_id : str
|
|
1785
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1786
|
+
key : str
|
|
1787
|
+
Index Key.
|
|
1788
|
+
|
|
1789
|
+
Returns
|
|
1790
|
+
-------
|
|
1791
|
+
Index
|
|
1792
|
+
API response as a typed Pydantic model
|
|
1793
|
+
|
|
1794
|
+
Raises
|
|
1795
|
+
------
|
|
1796
|
+
AppwriteException
|
|
1797
|
+
If API request fails
|
|
1798
|
+
"""
|
|
1799
|
+
|
|
1800
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}'
|
|
1801
|
+
api_params = {}
|
|
1802
|
+
if database_id is None:
|
|
1803
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1804
|
+
|
|
1805
|
+
if collection_id is None:
|
|
1806
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1807
|
+
|
|
1808
|
+
if key is None:
|
|
1809
|
+
raise AppwriteException('Missing required parameter: "key"')
|
|
1810
|
+
|
|
1811
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1812
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1813
|
+
api_path = api_path.replace('{key}', str(self._normalize_value(key)))
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
response = self.client.call('get', api_path, {
|
|
1817
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1818
|
+
'accept': 'application/json',
|
|
1819
|
+
}, api_params)
|
|
1820
|
+
|
|
1821
|
+
return self._parse_response(response, model=Index)
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
def delete_index(
|
|
1825
|
+
self,
|
|
1826
|
+
database_id: str,
|
|
1827
|
+
collection_id: str,
|
|
1828
|
+
key: str
|
|
1829
|
+
) -> Dict[str, Any]:
|
|
1830
|
+
"""
|
|
1831
|
+
Delete an index.
|
|
1832
|
+
|
|
1833
|
+
Parameters
|
|
1834
|
+
----------
|
|
1835
|
+
database_id : str
|
|
1836
|
+
Database ID.
|
|
1837
|
+
collection_id : str
|
|
1838
|
+
Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1839
|
+
key : str
|
|
1840
|
+
Index Key.
|
|
1841
|
+
|
|
1842
|
+
Returns
|
|
1843
|
+
-------
|
|
1844
|
+
Dict[str, Any]
|
|
1845
|
+
API response as a dictionary
|
|
1846
|
+
|
|
1847
|
+
Raises
|
|
1848
|
+
------
|
|
1849
|
+
AppwriteException
|
|
1850
|
+
If API request fails
|
|
1851
|
+
"""
|
|
1852
|
+
|
|
1853
|
+
api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}'
|
|
1854
|
+
api_params = {}
|
|
1855
|
+
if database_id is None:
|
|
1856
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1857
|
+
|
|
1858
|
+
if collection_id is None:
|
|
1859
|
+
raise AppwriteException('Missing required parameter: "collection_id"')
|
|
1860
|
+
|
|
1861
|
+
if key is None:
|
|
1862
|
+
raise AppwriteException('Missing required parameter: "key"')
|
|
1863
|
+
|
|
1864
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1865
|
+
api_path = api_path.replace('{collectionId}', str(self._normalize_value(collection_id)))
|
|
1866
|
+
api_path = api_path.replace('{key}', str(self._normalize_value(key)))
|
|
1867
|
+
|
|
1868
|
+
|
|
1869
|
+
response = self.client.call('delete', api_path, {
|
|
1870
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1871
|
+
'content-type': 'application/json',
|
|
1872
|
+
}, api_params)
|
|
1873
|
+
|
|
1874
|
+
return response
|
|
1875
|
+
|
|
1876
|
+
|
|
1877
|
+
def create_failover(
|
|
1878
|
+
self,
|
|
1879
|
+
database_id: str,
|
|
1880
|
+
target_replica_id: Optional[str] = None
|
|
1881
|
+
) -> DedicatedDatabase:
|
|
1882
|
+
"""
|
|
1883
|
+
Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation by a failover that did not finish also accepts this call as a repair, provided `targetReplicaId` names the member to promote.
|
|
1884
|
+
|
|
1885
|
+
Parameters
|
|
1886
|
+
----------
|
|
1887
|
+
database_id : str
|
|
1888
|
+
Database ID.
|
|
1889
|
+
target_replica_id : Optional[str]
|
|
1890
|
+
Target replica ID to promote. If not specified, the healthiest replica is selected.
|
|
1891
|
+
|
|
1892
|
+
Returns
|
|
1893
|
+
-------
|
|
1894
|
+
DedicatedDatabase
|
|
1895
|
+
API response as a typed Pydantic model
|
|
1896
|
+
|
|
1897
|
+
Raises
|
|
1898
|
+
------
|
|
1899
|
+
AppwriteException
|
|
1900
|
+
If API request fails
|
|
1901
|
+
"""
|
|
1902
|
+
|
|
1903
|
+
api_path = '/documentsdb/{databaseId}/failovers'
|
|
1904
|
+
api_params = {}
|
|
1905
|
+
if database_id is None:
|
|
1906
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1907
|
+
|
|
1908
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1909
|
+
|
|
1910
|
+
if target_replica_id is not None:
|
|
1911
|
+
api_params['targetReplicaId'] = self._normalize_value(target_replica_id)
|
|
1912
|
+
|
|
1913
|
+
response = self.client.call('post', api_path, {
|
|
1914
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1915
|
+
'content-type': 'application/json',
|
|
1916
|
+
'accept': 'application/json',
|
|
1917
|
+
}, api_params)
|
|
1918
|
+
|
|
1919
|
+
return self._parse_response(response, model=DedicatedDatabase)
|
|
1920
|
+
|
|
1921
|
+
|
|
1922
|
+
def list_operations(
|
|
1923
|
+
self,
|
|
1924
|
+
database_id: str,
|
|
1925
|
+
status: Optional[str] = None,
|
|
1926
|
+
limit: Optional[float] = None,
|
|
1927
|
+
offset: Optional[float] = None
|
|
1928
|
+
) -> DedicatedDatabaseOperationList:
|
|
1929
|
+
"""
|
|
1930
|
+
List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database.
|
|
1931
|
+
|
|
1932
|
+
Parameters
|
|
1933
|
+
----------
|
|
1934
|
+
database_id : str
|
|
1935
|
+
Database ID.
|
|
1936
|
+
status : Optional[str]
|
|
1937
|
+
Filter by operation status.
|
|
1938
|
+
limit : Optional[float]
|
|
1939
|
+
Maximum number of operations to return.
|
|
1940
|
+
offset : Optional[float]
|
|
1941
|
+
Number of operations to skip.
|
|
1942
|
+
|
|
1943
|
+
Returns
|
|
1944
|
+
-------
|
|
1945
|
+
DedicatedDatabaseOperationList
|
|
1946
|
+
API response as a typed Pydantic model
|
|
1947
|
+
|
|
1948
|
+
Raises
|
|
1949
|
+
------
|
|
1950
|
+
AppwriteException
|
|
1951
|
+
If API request fails
|
|
1952
|
+
"""
|
|
1953
|
+
|
|
1954
|
+
api_path = '/documentsdb/{databaseId}/operations'
|
|
1955
|
+
api_params = {}
|
|
1956
|
+
if database_id is None:
|
|
1957
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
1958
|
+
|
|
1959
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
1960
|
+
|
|
1961
|
+
if status is not None:
|
|
1962
|
+
api_params['status'] = self._normalize_value(status)
|
|
1963
|
+
if limit is not None:
|
|
1964
|
+
api_params['limit'] = self._normalize_value(limit)
|
|
1965
|
+
if offset is not None:
|
|
1966
|
+
api_params['offset'] = self._normalize_value(offset)
|
|
1967
|
+
|
|
1968
|
+
response = self.client.call('get', api_path, {
|
|
1969
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
1970
|
+
'accept': 'application/json',
|
|
1971
|
+
}, api_params)
|
|
1972
|
+
|
|
1973
|
+
return self._parse_response(response, model=DedicatedDatabaseOperationList)
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
def get_replicas(
|
|
1977
|
+
self,
|
|
1978
|
+
database_id: str
|
|
1979
|
+
) -> DedicatedDatabaseReplicas:
|
|
1980
|
+
"""
|
|
1981
|
+
Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode.
|
|
1982
|
+
|
|
1983
|
+
Parameters
|
|
1984
|
+
----------
|
|
1985
|
+
database_id : str
|
|
1986
|
+
Database ID.
|
|
1987
|
+
|
|
1988
|
+
Returns
|
|
1989
|
+
-------
|
|
1990
|
+
DedicatedDatabaseReplicas
|
|
1991
|
+
API response as a typed Pydantic model
|
|
1992
|
+
|
|
1993
|
+
Raises
|
|
1994
|
+
------
|
|
1995
|
+
AppwriteException
|
|
1996
|
+
If API request fails
|
|
1997
|
+
"""
|
|
1998
|
+
|
|
1999
|
+
api_path = '/documentsdb/{databaseId}/replicas'
|
|
2000
|
+
api_params = {}
|
|
2001
|
+
if database_id is None:
|
|
2002
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
2003
|
+
|
|
2004
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
2005
|
+
|
|
2006
|
+
|
|
2007
|
+
response = self.client.call('get', api_path, {
|
|
2008
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
2009
|
+
'accept': 'application/json',
|
|
2010
|
+
}, api_params)
|
|
2011
|
+
|
|
2012
|
+
return self._parse_response(response, model=DedicatedDatabaseReplicas)
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
def get_status(
|
|
2016
|
+
self,
|
|
2017
|
+
database_id: str
|
|
2018
|
+
) -> DatabaseStatus:
|
|
2019
|
+
"""
|
|
2020
|
+
Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information.
|
|
2021
|
+
|
|
2022
|
+
Parameters
|
|
2023
|
+
----------
|
|
2024
|
+
database_id : str
|
|
2025
|
+
Database ID.
|
|
2026
|
+
|
|
2027
|
+
Returns
|
|
2028
|
+
-------
|
|
2029
|
+
DatabaseStatus
|
|
2030
|
+
API response as a typed Pydantic model
|
|
2031
|
+
|
|
2032
|
+
Raises
|
|
2033
|
+
------
|
|
2034
|
+
AppwriteException
|
|
2035
|
+
If API request fails
|
|
2036
|
+
"""
|
|
2037
|
+
|
|
2038
|
+
api_path = '/documentsdb/{databaseId}/status'
|
|
2039
|
+
api_params = {}
|
|
2040
|
+
if database_id is None:
|
|
2041
|
+
raise AppwriteException('Missing required parameter: "database_id"')
|
|
2042
|
+
|
|
2043
|
+
api_path = api_path.replace('{databaseId}', str(self._normalize_value(database_id)))
|
|
2044
|
+
|
|
2045
|
+
|
|
2046
|
+
response = self.client.call('get', api_path, {
|
|
2047
|
+
'X-Appwrite-Project': self.client.get_config('project'),
|
|
2048
|
+
'accept': 'application/json',
|
|
2049
|
+
}, api_params)
|
|
2050
|
+
|
|
2051
|
+
return self._parse_response(response, model=DatabaseStatus)
|
|
2052
|
+
|